Using command line arguments in VBscript

command-line, command-line-arguments, vbscript

Solution

Set args = Wscript.Arguments

For Each arg In args
  Wscript.Echo arg
Next

From a command prompt, run the script like this:

CSCRIPT MyScript.vbs 1 2 A B "Arg with spaces"

Will give results like this:

1
2
A
B
Arg with spaces

Problem

How can I pass and access command line arguments in VBscript?

Original source