botanic Posted October 13, 2009 Share Posted October 13, 2009 (edited) I need to get the output of a command that runs in a command prompt, the problem is that run only returns a 1 or 0. I tried #RequireAdmin $Command="cmd /c dir c: /s";<-Your command RunWait($command & ">" & @scriptdir & "\output.txt","") $OutPut = FileRead( @scriptdir & "\output.txt",FileGetSize(@scriptdir & "\output.txt")) MsgBox(0, "", $OutPut) FileDelete( @scriptdir & "\output.txt") however the output.txt is blank even tho there is output. Edited October 13, 2009 by botanic Link to comment Share on other sites More sharing options...
TurionAltec Posted October 13, 2009 Share Posted October 13, 2009 Using StdoutRead is a lot easier than using a temp file. #include <Constants.au3> #RequireAdmin $Command=@comspec & " /c dir c:\ /s";<-Your command $pid=Run($command,@SystemDir,@SW_HIDE,$STDERR_MERGED) ProcessWaitClose($pid) $output=StdoutRead($pid) MsgBox(1,"output",$output) 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