Miloud Posted September 7, 2017 Posted September 7, 2017 How to get the result of the command? My code : Local $iRc = ShellExecute ( "G:\ffmpeg\bin\ffmpeg.exe" , "-version" , "G:\ffmpeg\bin\") ProcessWaitClose($iRc) $Message = StdoutRead($iRc)
Developers Jos Posted September 7, 2017 Developers Posted September 7, 2017 (edited) Use Run() with the appropriate parameters in stead of ShellExecute(). Jos Edited September 7, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Miloud Posted September 7, 2017 Author Posted September 7, 2017 The internet said that shellExecute() is suitable than run() when parameters are needed. This doesn't work either: Local $iRc = Run ( '"G:\ffmpeg\bin\ffmpeg.exe" "-version"' , "G:\ffmpeg\bin\") ;Local $iRc = Run ( '"G:\ffmpeg\bin\ffmpeg.exe" -version' , "G:\ffmpeg\bin\") ;Local $iRc = Run ( 'G:\ffmpeg\bin\ffmpeg.exe -version' , "G:\ffmpeg\bin\") ProcessWaitClose($iRc) $Message = StdoutRead($iRc) I need to get output from ffmpeg and determine wether commands finished execution! Hashim 1
Miloud Posted September 7, 2017 Author Posted September 7, 2017 ConsoleWrite(_getDOSOutput('ffmpeg -version', 'G:\ffmpeg\bin\') & @CRLF) Func _getDOSOutput($command , $wd='') Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, $wd, @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid, False, False) If @error Then ExitLoop Sleep(10) WEnd Return StringStripWS($text, 7) EndFunc ;==>_getDOSOutput https://stackoverflow.com/a/16581169/6228030
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