Jump to content

Greater than > not accepted as part of Parameters for ShellExecute or ShellExecuteWait


Recommended Posts

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 post
Share on other sites

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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...