mee Posted May 14, 2009 Share Posted May 14, 2009 Hello, i want to get the Output from a cmd.exe process. Ive tried this: $text = ControlCommand ("C:\WINDOWS\system32\cmd.exe", "", "Edit2", "GetLine",0) $text = ControlGetText("C:\WINDOWS\system32\cmd.exe","","") and $f = Run("cmd.exe", "C:\WINDOWS\system32\",@SW_MINIMIZE,$STDOUT_CHILD) Local $data = "" While True $data &= StdoutRead($f) MsgBox(0,"Tets",$data) Sleep(25) WEnd None of them work for me. Is there a Syntax problem? Do i need different parameters or attributes? Thank you. Link to comment Share on other sites More sharing options...
BrettF Posted May 14, 2009 Share Posted May 14, 2009 Does something like this work? #include <Constants.au3> $foo = Run(@ComSpec, "", @SW_MINIMIZE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
JackDinn Posted May 14, 2009 Share Posted May 14, 2009 (edited) did a dir to edit box #include <Constants.au3> #include <GUIConstantsEx.au3> $HG_tracert = GUICreate("Test", 450, 355, 200, 125, -1, -1) $tcrmb = GUICtrlCreateEdit("Test", 5, 5, 445, 300) GUISetBkColor(0x8899ff) GUISetState(@SW_SHOW) $output = Run(@ComSpec & " /c dir", "", @SW_HIDE, $STDOUT_CHILD) $tcrtout = "" $tcrcatch = "" While 1 $tcrtout &= StdoutRead($output) If $tcrtout <> $tcrcatch Then GUICtrlSetData($tcrmb, $tcrtout) $tcrcatch = $tcrtout EndIf If @error Then ExitLoop WEnd While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited May 14, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
FreeFry Posted May 14, 2009 Share Posted May 14, 2009 If your program is running the cmd.exe, you could pipe the output out to a file: Run(@ComSpec & " /c dir > output.txt", @ScriptDir) Basically the same as doing this in a command prompt: dir > output.txt 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