tlman12 Posted February 8, 2010 Share Posted February 8, 2010 is there a way to run a command prompt and acruattly read the exact results text to a variable? Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 8, 2010 Share Posted February 8, 2010 MsgBox(64, 'Date', _getDOSOutput('date /t')) Func _getDOSOutput($command) Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid, False, False) If @error Then ExitLoop Sleep(10) WEnd Return $text EndFunc ;==>_getDOSOutput Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
tlman12 Posted February 8, 2010 Author Share Posted February 8, 2010 MsgBox(64, 'Date', _getDOSOutput('date /t')) Func _getDOSOutput($command) Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid, False, False) If @error Then ExitLoop Sleep(10) WEnd Return $text EndFunc ;==>_getDOSOutput i'm having the same problem with this one as i did with the one in the help file, it's not returning the results of a dsmove command Link to comment Share on other sites More sharing options...
Mobius Posted February 8, 2010 Share Posted February 8, 2010 i'm having the same problem with this one as i did with the one in the help file, it's not returning the results of a dsmove command What about when you call dsmove directly instead of calling the cmd shell first? $OUT = "" $PID = Run('dsmove.exe "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newname "Kim Ralls"',@SCRIPTDIR,@SW_HIDE,7) IF $PID THEN WHILE 1 $OUT &= StdoutRead($PID) IF @ERROR THEN EXITLOOP WEND ELSE $OUT = "Failed to execute program." ENDIF MsgBox(64,@SCRIPTNAME,$OUT) Vlad Link to comment Share on other sites More sharing options...
MvGulik Posted February 8, 2010 Share Posted February 8, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
tlman12 Posted February 9, 2010 Author Share Posted February 9, 2010 What about when you call dsmove directly instead of calling the cmd shell first? $OUT = "" $PID = Run('dsmove.exe "CN=Kim Akers,OU=Sales,DC=Contoso,DC=Com" -newname "Kim Ralls"',@SCRIPTDIR,@SW_HIDE,7) IF $PID THEN WHILE 1 $OUT &= StdoutRead($PID) IF @ERROR THEN EXITLOOP WEND ELSE $OUT = "Failed to execute program." ENDIF MsgBox(64,@SCRIPTNAME,$OUT) Vlad this probably would work but i eneded up just doing what i needed to do with a series of before and after checks and finished what i needed. but i'll probably put this in because it would make it better to see whether it wouldn't move because of access denied or not found, but i won't be able to check this for a while thank you everyone for your responses 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