Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking return codes in Win 2000?

Status
Not open for further replies.

Jitwad

Programmer
Sep 8, 2002
13
CA
Is there a way to check a return code in Win2k?

e.g. using a command line tool -- is there a way to check a simple return code (like the $? command in UNIX) ?

Thanks.
 
In a batch file you can use -

if [not] errorlevel number command


errorlevel number
This specifies a true condition only if the previous program run by Cmd.exe returned an exit code equal to or greater than number.

<< JOC >>
 
oh - also

%errorlevel% expands into a string representation of the current value of errorlevel, provided that there is not already an environment variable with the name ERRORLEVEL, in which case you will get its value instead. After running a program, the following illustrates errorlevel use:

Both answers taken from win2k - start->help
on the index tab type &quot;if command&quot;

<< JOC >>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top