DanielDaniel Posted March 4, 2011 Posted March 4, 2011 Hi all, I am running the following command: $val = Run(@ComSpec & " /c " & chr(34) & $CmdLineRaw & chr(34), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) then reading the output with StdOutRead. All works fine, except for the fact that $val seems to contain a random return code from the command. The value of $CmdLineRaw is a VBS script that ends with the line WScript.Quit(2). But $val never gets the value of 2 (it looks like it contains the process ID of the command when it ran. Before I added StdOutRead to Run command, $val was receiving the return code correctly. Any ideas what I am doing wrong? I suspect that it is because I am using the "cmd /c" part, but using that was the only way I could get StdOutRead to work. Cheers, Daniel
smartee Posted March 4, 2011 Posted March 4, 2011 you are right. run returns the pid, runwait, however, returns the exit code.
JohnOne Posted March 4, 2011 Posted March 4, 2011 Run returns the PID You want RunWait, which returns the exit code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
DanielDaniel Posted March 4, 2011 Author Posted March 4, 2011 you are right. run returns the pid, runwait, however, returns the exit code. Thanks! I changed Run for RunWait, and now the StdOut has stopped working. Here's the code: $val = RunWait(@ComSpec & " /c " & chr(34) & $CmdLineRaw & chr(34), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
smartee Posted March 4, 2011 Posted March 4, 2011 Thanks! I changed Run for RunWait, and now the StdOut has stopped working. Here's the code: $val = RunWait(@ComSpec & " /c " & chr(34) & $CmdLineRaw & chr(34), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Probably you can try sending output to a file directly like iamtheky did
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