In a script (.vbs file), how do I capture command-line arguments? Say I have
a script named "Script.vbs" at C:\, which contains the following code:

MsgBox Command

then run it from a DOS window (at the C:\ prompt) by typing:

Script.vbs "Test"

I want a message-box to pop up with "Test" in it. However, all I get is a
blank message-box with an 'OK' button.

What do I need to put in the place of 'Command'???

Re: Command Line Arguments by Tim

Tim
Thu Aug 28 06:55:27 CDT 2003

You could try this:

Set Args = WScript.Arguments

Then you would have Args.Count for the number of arguments, and an array
Args(0) to Args(Args.Count-1)

"JasonP" <jasonp@i.com> wrote in message
news:%23pvI$5JbDHA.2620@TK2MSFTNGP09.phx.gbl...
> In a script (.vbs file), how do I capture command-line arguments? Say I
have
> a script named "Script.vbs" at C:\, which contains the following code:
>
> MsgBox Command
>
> then run it from a DOS window (at the C:\ prompt) by typing:
>
> Script.vbs "Test"
>
> I want a message-box to pop up with "Test" in it. However, all I get is a
> blank message-box with an 'OK' button.
>
> What do I need to put in the place of 'Command'???
>
>



Re: Command Line Arguments by Sandeepan

Sandeepan
Thu Aug 28 14:22:01 CDT 2003

You can use wscript.Arguments
"JasonP" <jasonp@i.com> wrote in message
news:%23pvI$5JbDHA.2620@TK2MSFTNGP09.phx.gbl...
> In a script (.vbs file), how do I capture command-line arguments? Say I
have
> a script named "Script.vbs" at C:\, which contains the following code:
>
> MsgBox Command
>
> then run it from a DOS window (at the C:\ prompt) by typing:
>
> Script.vbs "Test"
>
> I want a message-box to pop up with "Test" in it. However, all I get is a
> blank message-box with an 'OK' button.
>
> What do I need to put in the place of 'Command'???
>
>