[comp.os.msdos.programmer] errorlevel/exit codes

ted@helios.ucsc.edu (Ted Cantrall) (08/01/90)

After several failed attempts to solve this as a novice asslembly
programmer, I'm ready to say "HELP".

In a batch file, the status of the
privious command (some of them, anyway) can be tested via the
IF ERRORLEVEL command. I would like to be able to print to the screen 
the errorlevel returned by a command as a part of debugging that command.
Using the IF ERRORLEVEL can be very tiresome if the routine is NOT
returning what is expected. So far, I have found that the errorlevel is
returned as an exit code in the AL register, but what happpens after that
I can only guess (and none of my guesses have been right, yet).
I've tried to too-obvious tactic of following the command in question 
with a routine that prints the contents of the AL reg, but the batch
processing must change the AL, because it is always 00.
                ------                ------
Can some kind soul tell me how to access the errorlevel without going
to the extreme of dissassembling COMMAND.COM?
		Many thanks to all who respond,		-ted-


-------------------------------------------------------------------------------
ted@helios.ucsc.edu         | "If I get any phone calls while I'm gone,
(408)459-2110               |    just don't answer them."
-------------------------------------------------------------------------------