Jump to content

Returning A Dos Command Error Code.


Recommended Posts

I have .Net console application which exits with either 0 (success) or 1 (failure). If I run this in a DOS window I can echo %errorlevel% and it has the right value. I need to return this to the script so I can take remedial action after my call to RunWait returns.

Can anyone tell me how I can get the error code? Whether the command executes successfully or not, RunWait returns successfully either way.

Link to comment
Share on other sites

I have .Net console application which exits with either 0 (success) or 1 (failure). If I run this in a DOS window I can echo %errorlevel% and it has the right value. I need to return this to the script so I can take remedial action after my call to RunWait returns.

Can anyone tell me how I can get the error code? Whether the command executes successfully or not, RunWait returns successfully either way.

from the help file

$val = RunWait("Notepad.exe", "C:\WINDOWS", @SW_MAXIMIZE)
; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

from the help file

$val = RunWait("Notepad.exe", "C:\WINDOWS", @SW_MAXIMIZE)
; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)
Doh!

Thanks. :"> Upto now I've only used @error and not the RunWait return code. Glad to know that was an easy outcome.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...