views:

298

answers:

2

I have a batch program that calls several child batch programs and they make entensive use of various DOS commands. In case of error, i would like to provide logging information about the error details to the user.

This page details the various MS-DOS commands that can set an errorlevel http://support.microsoft.com/kb/81819

How do i know what are the various error codes (number in the range 0 to 256) that these commands can return and what are their interpretations in english?

+1  A: 

If you really are on DOS (which I highly doubt) then the only way is

command
if errorlevel 255 echo 255
if errorlevel 254 echo 254
if errorlevel 253 echo 253
...
if errorlevel 1 echo 1
if errorlevel 0 echo 0

The interpretations in a natural language are then up to you, as you should know what exactly you did try there.

Note that on Windows you can usually just do

command
echo %errorlevel%
Joey
I am on Windows 7. I am using the command shell (cmd.exe) for executing the batch programs.
Santhosh
@Santhosh: Then please, *please* stop talking about MS-DOS. It's incorrect and misleading.
Joey
@Joey: done! i have edited the question;
Santhosh
+1  A: 

A partial list of errorlevel values can be found here:

http://www.freedos.org/freedos/news/technote/207.html

lhillman