[comp.sys.ibm.pc] Setting ERRORLEVEL in DOS

wan@pollux.usc.edu (Qiang Wan) (03/27/90)

This may be a naive question for all you PC experts. I am trying
to set the ERRORLEVEL to zero in DOS, and couldn't find a way
to accomplish it. I had to use a C program which exits with 0.
Any suggestion is appreciated. Please reply by e-mail. Thanks.

ching wan

georgf@polari.UUCP (George Forsman) (03/27/90)

In article <23706@usc.edu> wan@pollux.usc.edu (Qiang Wan) writes:
>This may be a naive question for all you PC experts. I am trying
>to set the ERRORLEVEL to zero in DOS, and couldn't find a way
>to accomplish it. I had to use a C program which exits with 0.
>Any suggestion is appreciated. Please reply by e-mail. Thanks.
>
>ching wan

You will have to do it with a program, like the one you've written.  The
simplest one possible follows:

   mov ax,4c00h
   int 21h

This can be entered in DEBUG and saved as a .COM file.  All it does is call
the MS-DOS terminate process function with a return code of 0 (the 00 part of
4c00).  This version of the program will save the overhead of the C startup
code (and is obviously a little bit smaller :)

George
...uw-beaver!sumax!polari!georgf