Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!pbox!romed!svo!mfbbs!marc From: marc@mfbbs.UUCP Newsgroups: comp.lang.c Subject: Re: 1 Turbo C question (used to be 2) Message-ID: <3409@mfbbs.UUCP> Date: Sat, 12-Sep-87 15:09:12 EDT Article-I.D.: mfbbs.3409 Posted: Sat Sep 12 15:09:12 1987 Date-Received: Tue, 15-Sep-87 01:17:11 EDT References: <9061@brl-adm.ARPA> <1445@killer.UUCP> Reply-To: marc@mfbbs.UUCP (Marc Randolph) Organization: usr/bbs development center, Tulsa, Ok Lines: 30 Summary: Incorrect order of IF statements Followup-To: In article <1445@killer.UUCP> toma@killer.UUCP (Tom Armistead) writes: >In article <9061@brl-adm.ARPA>, bonak%cs.uiowa.edu@RELAY.CS.NET writes: >> value of an exit(value) that comes from a C program >> termination? > >. MAINPGM >. IF ERRORLEVEL 0 GOTO GOOD >. IF ERRORLEVEL 1 GOTO BAD >. IF ERRORLEVEL 2 GOTO HAWAII > [correct stuff deleted] >--- >UUCP: killer!toma >Tom Armistead That batch file won't work (don't worry, I consider it Microsofts fault!). DOS tests errorlevels by equal to or greater than the number you are testing against. This means in your batch file, EVERY errorlevel above and equal to 0 would 'GOTO GOOD'. So, the correct batch file would be: IF ERRORLEVEL 2 GOTO HAWAII IF ERRORLEVEL 1 GOTO BAD IF ERRORLEVEL 0 GOTO GOOD [etc] -- Marc Randolph UUCP: ...!rutgers!pbox!svo!mfbbs!marc FidoNet: 170/329 or 170/220