Using command line arguments in VBscript

2019-01-08 21:33发布

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

2条回答
走好不送
2楼-- · 2019-01-08 22:00

If you need direct access:

WScript.Arguments.Item(0)
WScript.Arguments.Item(1)
...
查看更多
时光不老,我们不散
3楼-- · 2019-01-08 22:02
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
查看更多
登录 后发表回答