Wito Posted July 1, 2021 Share Posted July 1, 2021 Dear all, I presume this is an old question, but I did not find an answer. Using the function ShellExecute or ShellExecuteWait, the greater than symbol ">" in the arguments or parameters is apparently not supported and breaks the script. I would like to use it, because it would make the script really silent, no command screens popping up. How can the greater than sign be passed as a part of the parameters? ;Script Options Dim $RC $RC = AutoItSetOption ( "MustDeclareVars" , 1 ) ;Declare variables Dim $Command Dim $Arguments ;Initialise Variables $Command = @ScriptDir & "\MyCommand.exe" $Arguments = '/Quiet /NoRestart /Argument3 /Argument4' ;$Arguments = '/Quiet /NoRestart /Argument3 /Argument4 > nul 2>&1' ; The > character breaks the script $RC = ShellExecuteWait( $Command , $Arguments ) ; $RC = ShellExecuteWait( $Command , $Arguments & ' > nul 2>&1' ) ; The > character breaks the script Thanks in advance for your answer, Kind regards, Link to comment Share on other sites More sharing options...
Rurorita Posted July 2, 2021 Share Posted July 2, 2021 (edited) Try ShellExecute(@ComSpec, '/C "' & $command & '" ' & $arguments & '> nul 2>&1') Run(@ComSpec & ' /C "' & $command & '" ' & $arguments & '> nul 2>&1') Edited July 2, 2021 by Rurorita Amateur Coder - UDF's _storageS-UDF , _netcode-UDF (_netcode_Core-UDF, _netcode_AddonCore-UDF, _netcode_Proxy-UDF, _netcode_Relay-UDF, _netcode_Router-UDF) Link to comment Share on other sites More sharing options...
Wito Posted July 4, 2021 Author Share Posted July 4, 2021 Dear Rurorita, Thank you for the hint. The '> nul 2&1' has to be handled by cmd.exe. It gets more complex because @ComSpec opens a window. I think I'll just let it go. Thank you very much for your assistance! Kind regards, Link to comment Share on other sites More sharing options...
Developers Jos Posted July 4, 2021 Developers Share Posted July 4, 2021 Use RUN() in stead of ShellExecute() and use @COMSPEC. 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. Link to comment Share on other sites More sharing options...
Rurorita Posted July 4, 2021 Share Posted July 4, 2021 You have the option to spawn the new window hidden. ShellExecute(@ComSpec, '/C "' & $command & '" ' & $arguments & '> nul 2>&1', "", "open", @SW_HIDE) Run(@ComSpec & ' /C "' & $command & '" ' & $arguments & '> nul 2>&1', "", @SW_HIDE) Read the Help file about ShellExecute() and Run() they tell you alot Amateur Coder - UDF's _storageS-UDF , _netcode-UDF (_netcode_Core-UDF, _netcode_AddonCore-UDF, _netcode_Proxy-UDF, _netcode_Relay-UDF, _netcode_Router-UDF) 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