Jump to content

Recommended Posts

Posted

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,

Posted

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,

Posted

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

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...