处理命名参数的框架:

时间:2013-11-14 21:21:53

标签: vbscript cmd

有人可以给我一个基本的骨架工具,允许我运行不同的命令行参数。

例如

cscript TestSpeed.vbs /Internet
'or
cscript testSpeed.vbs /RW

1 个答案:

答案 0 :(得分:0)

Option Explicit

WScript.Quit Main()

Function Main()
  Main = 1

  Dim oWAN : Set oWAN = WScript.Arguments.Named
  Select Case True
    Case 1 <> oWAN.Count
      WScript.Echo "Usage: cscript TestSpeed.vbs /Internet OR /RW"
    Case oWAN.Exists("Internet")
      WScript.Echo "Test Internet speed"
      Main = 0
    Case oWAN.Exists("RW")
      WScript.Echo "test RW speed"
      Main = 0
  End Select
End Function