2016-08-21 63 views
0

我嘗試使用if語句,但出現錯誤,Subscript out of range,我知道爲什麼出現錯誤。如何檢查一個參數是否被調用到一個vbscript腳本中。如何檢查參數是否被調用到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 

回答

1
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