Article View: comp.sys.ibm.pc
Article #25604Re: More on setting DOS errorlevel
From: bentrup
Date: Tue, 15 Mar 1988 19:38
Date: Tue, 15 Mar 1988 19:38
41 lines
1613 bytes
1613 bytes
>/* Mar 14, 1988 by murillo@sigi.Colorado.EDU in uiucdcsp:comp.sys.ibm.pc */
>The following code shows that exit(errorlevel) works. The problem is
>that if errorlevel is set with an exit(5) for example, all if tests for
>values <= to 5 are tested as true.
> exit(5);
> FIVE!
> FOUR!
> ...
> ZERO!
>Why would (errorlevel 0) test true if the exit is exit(5)??!!
>if errorlevel 8 echo EIGHT!
> ...
>if errorlevel 1 echo ONE!
>if errorlevel 0 echo ZERO!
From the manual "ERRORLEVEL number is true if the previous program had an
exit code of number or higher"
^^^^^^
I think you want to do something akin to
if errorlevel 8 goto process_8
if errorlevel 7 goto process_7
...
:process_8
<whatever error 8 does>
goto exit
:process_7
<etc for 7>
goto exit
...
:exit
john
John Bentrup
University of Illinois at Urbana-Champaign
Department of Computer Science
arpa bentrup@a.cs.uiuc.edu bentrup@uiuc.ARPA
csnet bentrup%uiuc@csnet-relay
usenet {pur-ee,convex,ihnp4}!uiucdcs!bentrup
Technical Details
Message-ID:
<75800056@uiucdcsp>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!uwvax!umn-d-ub!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsp!bentrupReferences:
<4835@sigi.Colorado.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!uwvax!umn-d-ub!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsp!bentrup From: bentrup@uiucdcsp.cs.uiuc.edu Newsgroups: comp.sys.ibm.pc Subject: Re: More on setting DOS errorlevel Message-ID: <75800056@uiucdcsp> Date: 15 Mar 88 19:38:00 GMT References: <4835@sigi.Colorado.EDU> Lines: 41 Nf-ID: #R:sigi.Colorado.EDU:4835:uiucdcsp:75800056:000:1131 Nf-From: uiucdcsp.cs.uiuc.edu!bentrup Mar 15 13:38:00 1988