SystemWontAccept Posted January 27, 2010 Share Posted January 27, 2010 (edited) I did some searching and it appears the way to do this is send the output to a temp text file and then read it back. Is there a simpler way? RunWait( "cmd /c c:\windows\system32\snmputil.exe get 176.88.15.30 Public .1.3.6.1.2.1.2.2.1.10.4" & ">" & "temp.txt" ) $output= FileRead( "temp.txt", FileGetSize("temp.txt") ) FileDelete( "temp.txt" ) This works, just looking for input on the best way to run a DOS app and dump the output to a variable. Is the step of writing to a file needed? Edited January 27, 2010 by SystemWontAccept Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 27, 2010 Share Posted January 27, 2010 Look in the help file at StdOutRead(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Fire Posted January 27, 2010 Share Posted January 27, 2010 Hi. Script writed by MAT. It works excelent. Local $sCommand = "c:\windows\system32\snmputil.exe get 176.88.15.30 Public .1.3.6.1.2.1.2.2.1.10.4" MsgBox (0, "", _RunCmd ($sCommand)) Func _RunCmd ($sCommand) If StringLeft ($sCommand, 1) = " " Then $sCommand = " " & $sCommand Local $nPid = Run (@Comspec & " /c" & $sCommand, "", @SW_Hide, 8), $sRet = "" If @Error then Return "ERROR:" & @ERROR ProcessWait ($nPid) While 1 $sRet &= StdoutRead($nPID) If @error Or (Not ProcessExists ($nPid)) Then ExitLoop WEnd Return $sRet EndFunc ; ==> _RunCmd TrevorPearson 1 [size="5"] [/size] 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