Bokkie Posted March 26, 2006 Share Posted March 26, 2006 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 More sharing options...
GaryFrost Posted March 26, 2006 Share Posted March 26, 2006 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 More sharing options...
Bokkie Posted March 26, 2006 Author Share Posted March 26, 2006 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 More sharing options...
gamerman2360 Posted March 26, 2006 Share Posted March 26, 2006 Another way to get an exit code can be found at this url: http://www.autoitscript.com/forum/index.php?showtopic=23096. To get info from a cmd prompt see the function reference for StderrRead() in the help file. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now