我尝试使用 if 语句,但出现错误,
Subscript out of range
,我知道为什么会出现错误。如何检查 vbscript 脚本是否调用了参数。
if args.count > -1 then
exec(args(0)) 'exec is a function that I defined. I know this is working.
wscript.quit
end if
If WScript.Arguments.Count > 0 Then
WScript.Echo "Arguments were passed"
End If
args = WScript.Arguments.Count
WScript.Echo "This many arguments were passed " & args
如果 WScript.Arguments.Count > 0 那么 消息框 WScript.Arguments.item(0) 别的 msgbox“没有传递任何内容” 结束如果