Sign in to follow this  
Followers 0
Bokkie

Returning A Dos Command Error Code.

4 posts in this topic

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.

Share this post


Link to post
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.

 

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0