Sign in to follow this  
Followers 0
zzen11

retrieve the return code of the program

6 posts in this topic

How do I retrieve the return code of a program. For example, I can use the RunWait("program.exe"). how do I retrieve the return code generated by the program.exe (like errorlevel)?

Z

Share this post


Link to post
Share on other sites



$errorcode = RunWait("program.exe")

It's in the help file.


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$errorcode = RunWait("program.exe")

It's in the help file.

<{POST_SNAPBACK}>

Well, the return value here from RunWait() is about RunWait() call, not the return value by the "program.exe". Edited by zzen11

Share this post


Link to post
Share on other sites

If program.exe ran correctly, $errorcode should be 0, in Ejocs example.

Share this post


Link to post
Share on other sites

If program.exe ran correctly, $errorcode should be 0, in Ejocs example.

<{POST_SNAPBACK}>

The problem I try to solve is that the program.exe can return different values when it quits. I want to get those values.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I made an example for you, just compile the first two into executables.

return1.au3:

exit(1)

return2.au3:

exit(2)

errorcode.au3:

$ret = runwait("return1.exe")
msgbox(0,"",$ret)

$ret = runwait("return2.exe")
msgbox(0,"",$ret)
Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

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