I write a VBScript script in which I call another process. I want to pass to that child process all the command line arguments my script got.
How can I do that efficiently and elegantly?
I write a VBScript script in which I call another process. I want to pass to that child process all the command line arguments my script got.
How can I do that efficiently and elegantly?
Arguments passed into a vbscript are held in the Arguments
collection. You can get to these with the following code:
argument1 = WScript.Arguments(0)
argument2 = WScript.Arguments(1)
...
And so on. Once you have them it's simple enough to pass them onto the process you are calling by using them in the command line that executes the child process
Dim myShell : Set myShell = CreateObject("Wscript.Shell")
myShell.Run "cscript.exe <path to child vbs> " & Chr(34) & argument1 & Chr(34) & " " & chr(34) & argument2 & Chr(34)