我需要通过参数启动vbs script
并且与传递的参数相关,请看弹出窗口。
示例:
Dim Arg, var1, var2
Set Arg = WScript.Arguments
'Parameter1, begin with index0
var1 = Arg(0)
if (instr(WScript.Arguments.Name,"Printer")> 0 then
wscript.echo "Printer type..."
end if
if (instr(WScript.Arguments.Name,"help")> 0 then
wscript.echo "help..."
end if
提前致谢
'Clear the objects at the end of your script.
set Arg = Nothing
答案 0 :(得分:0)
像你这样称呼你的脚本
myscript.vbs /help
并访问args,如此
'setup the named argument collection
set argNamedCollection = WScript.Arguments.Named
'get the arguments passed in
argHelp = argNamedCollection.Item("help")
argPrinter = argNamedCollection.Item("printer")
'or check directly
'check for help arguments
if argNamedCollection.Exists("help") then
'do somthing
end if