如何检索输入参数?
How to retrieve input parameters?
我有两个脚本:One.vbs
和 Email.vbs
。
One.vbs
正在使用参数 reportFile
(字符串)调用 Email.vbs
,如下所示。
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "email.vbs" , reportFile
当我尝试检索 Email.vbs
中的参数时
' == Read the Argument
fileName = WScript.Arguments.Item(0)
我遇到错误
Subscript out of range
错误代码 800A0009。
我已经尝试了很多谷歌搜索,但似乎没有任何效果像预期的那样。只是想知道我做的是否正确,如果不正确,错误是什么?
问题是 objShell.Run
的第二个参数是 intWindowStyle
(参见 MSDN):
Optional. Integer value indicating the appearance of the program's
window. Note that not all programs make use of this information.
试试这个,即不带逗号:
objShell.Run "email.vbs " & reportFile
我有两个脚本:One.vbs
和 Email.vbs
。
One.vbs
正在使用参数 reportFile
(字符串)调用 Email.vbs
,如下所示。
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "email.vbs" , reportFile
当我尝试检索 Email.vbs
中的参数时
' == Read the Argument
fileName = WScript.Arguments.Item(0)
我遇到错误
Subscript out of range
错误代码 800A0009。
我已经尝试了很多谷歌搜索,但似乎没有任何效果像预期的那样。只是想知道我做的是否正确,如果不正确,错误是什么?
问题是 objShell.Run
的第二个参数是 intWindowStyle
(参见 MSDN):
Optional. Integer value indicating the appearance of the program's window. Note that not all programs make use of this information.
试试这个,即不带逗号:
objShell.Run "email.vbs " & reportFile