How do I make FBC compiler to throw a DOS ERRORLEVEL?

DOS specific questions.
bulrush
Posts: 61
Joined: Nov 02, 2010 12:56
Location: Michigan

How do I make FBC compiler to throw a DOS ERRORLEVEL?

Postby bulrush » Aug 14, 2013 18:55

- Windows 7
- Freebasic .90.1

I'm using a batch file under a command window in Win7 to compile and run my test programs while I learn FB. But when FBC.EXE gets a compiler error, it does not set the DOS errorlevel. Here's my batch file go.bat:

Code: Select all

@echo off
\compilers\freebasic\fbc test1.bas
if errorlevel 1 then goto myexit
test1
echo "Errorlevel is "
echo %ERRORLEVEL%
:myexit
echo on


I got it. Here's what I ended up with.

Code: Select all

@echo off
if exist del test1.exe
\compilers\freebasic090\fbc test1.bas
if errorlevel 1  goto myexit
if exist test1.exe test1
echo Errorlevel is %ERRORLEVEL%
:myexit
echo on

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 2 guests