Jump to content

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.

Link to comment
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 comment
Share on other sites

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

Be aware that there appears to be some kind of OS-imposed constraint on passing $CmdLine[] parameters. B)

Probably depends on the total byte-size of the passed parameters, rather than the number of them. I'm still stuck with this problem in a SendTo tool that takes a selection of files and places their pathnames on the clipboard. Looks like 300-400 Kb is the ceiling. :whistle:

http://www.hiddensoft.com/forum/index.php?showtopic=426

Link to comment
Share on other sites

Valik, I shouldn't have replied last night being tired an all. I saw the & " " this morning and felt dumb. :iamstupid:

Thanks for passing on the string size issue Trids. I invision the string will be less than 100 characters in size. I would expect that needing more than 100-150 characters would require GUI implementation or numerous inputboxes to effectively manage such a large undertaking.

I never considered $CmdLine[x] as an array. The help file didn't lead me to think it was until looking at Valik's code with fresh eyes and mind this morning.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...