# Passing Cmdline[x] To Runwait()

## Recommended Posts

Having trouble coming up with modular code that can accept any number of CmdLine[x] parameters to be included in a RunWait() command.

I use VBscript during the logon process for a number of tasks. I want the ability to pass any number of command line switches to a compiled AutoIT3 script, leveraging the RunAsSet() function on remote workstations.

WshShell.Run "\\NetworkShare\AU3program.exe Myprogram.exe /A /F /K /Q ", 1, TRUE

AU3program.exe needs to execute MyProgram.exe and any trailing switches in a RunWait() construct.

##### Share on other sites

Untested...

$szLine = "" For$i = 1 To $CmdLine[0]$szLine = $szLine &$CmdLine[$i] If$i < $CmdLine[0] Then$szLine = $szLine & " " Next ;$szLine is now a string with all command line arguments passed.

RunWait("path\to\program.exe " & $szLine) Edited by Valik ##### Link to post ##### Share on other sites Will I need to add & " " & between$szLine & $CmdLine[$i] to have a space between each parameter?

I can test it tomorrow using MSGBOX()...Head hursts from coding...

##### Share on other sites

If $i <$CmdLine[0] Then $szLine =$szLine & " "

which appends a space at the end of each argument except the last one.

##### Share on other sites

...I  want the ability to pass any number of command line switches to a compiled AutoIT3 script...

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...