Followers 0

Passing Cmdline[x] To Runwait()

6 posts in this topic

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 this post

Share on other sites

#2 ·  Posted (edited)

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 Share this post 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 this post

Share on other sites

That's already being done by:

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

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

Share this post

Share on other sites

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

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
Followers 0