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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return code MS DOS question

Status
Not open for further replies.

Sudmill

Programmer
Apr 20, 2001
65
GB
is an environmental variable set to the value of the last return code the cmd session received.
I am only asking so that my testing is made easier, so when my application returns a returncode (not directed), i can interrogate this return code onthe fly.

I know I could write a batch file to do this, but Im not sure how to do this on the fly.
Any ideas, as Im sure I read how to do this somewhere before!

Cheers

John.
 
Since cmd.exe is a DOS emulation program, all environment variables are inherited from NT itself.

You can set them within a session, but this will not be propagated to other sesions.

I hope this goes some way to answering your question.
 
Actually all I wanted was to print return code in the current session which I have now found;

ECHO %ERRORLEVEL%

But thanks anyway !

J.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top