Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In windows prompt i am launching an app. I'd like to see the error code it returns. How do i display it?

share|improve this question
add comment

2 Answers

ECHO %ERRORLEVEL%

You can also use an IF command to take different actions based on the value:

IF %ERRORLEVEL% LEQ 1 goto okay
share|improve this answer
    
As a test i wrote calc then ECHO %ERRORLEVEL% after closing normally. Do i need to set it to 0 each time or something? Why am i getting 9009? which is DNS server not authoritative for zone. from what visual studios error lookup is telling me. –  acidzombie24 Feb 23 '11 at 6:00
1  
@acidzombie24: Errorlevels are set by the individual program and don't correspond to Windows API exit codes. When I ran calc just now, I got a 0. Running a non-command-line program isn't going to set the errorlevel at the command line. What you saw was the one for an earlier command. –  Dennis Williamson Feb 23 '11 at 6:25
add comment

I guess you are running the batch file from the RUN utility in Windows.

Try this

runapp.bat > c:\outputlog.txt

This will allow you to review the output and see if there are any error messages. Alternatively, fire up Command Prompt and run the batch file from there directly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.