AvN Posted October 11, 2009 Share Posted October 11, 2009 Hi, Quick question:I am trying to run an application using cmd.exe. How can I get the content of the commands that I have executed, from the screen and send it to a file? Here is what I have try,Just an example, but it seems not to work #include <file.au3> $tempFile = ("C:\Documents and Settings\Avul\My Documents\temp\tempfile.txt"); creating a temp file Local $console = Run ("C:\WINNT\system32\CMD, $STDERR_CHILD + $STDOUT_CHILD") Run ("C:\WINNT\system32\CMD") ;opening cmd WinWait ("C:\WINNT\system32\CMD.exe") sleep(1000) MsgBox(0, "","Console opened",2) Send ("Help{enter}") ; sending a command ;in the following lines I am trying to take what ("Help{enter}") had put on the screen and send it to the tempfile Local $line While 1 $line = StdoutRead($console) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend $line = StdoutRead ("C:\WINNT\system32\CMD.exe") ;FileWrite($tempFile, $line) _FileWriteLog ($tempFile, $line) Your help will be much appreciated. AvN Link to comment Share on other sites More sharing options...
Skrip Posted October 11, 2009 Share Posted October 11, 2009 Hello. This is the wrong forum to ask for help. http://www.autoitscript.com/forum/index.php?showforum=2 <= here would be better. I have reported your post, saying it's the wrong forum. Hopefully it will be moved soon, and people can help. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] 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