提供从命令行对命名参数的访问。
WshArguments 对象的 Named 属性返回 WshNamed 对象(有名称的参数集)。该参数集将参数名用作索引,以便检索个别参数值。访问命令行参数集有三种方式:
下面代码显示已命名和未命名的命令行参数的数目。
<package> <job id="JS"> <script language="JScript"> var argsNamed = WScript.Arguments.Named
; var argsUnnamed = WScript.Arguments.Unnamed; WScript.Echo("There are " + argsNamed.length + " named arguments."); WScript.Echo("There are " + argsUnnamed.length + " unnamed arguments."); </script> </job> <job id="VBS"> <script language="VBScript"> Dim argsNamed, argsUnnamed Set argsNamed = WScript.Arguments.Named
Set argsUnnamed = WScript.Arguments.Unnamed WScript.Echo "There are " & argsNamed.Count & " named arguments." WScript.Echo "There are " & argsUnnamed.Count & " unnamed arguments." </script> </job> </package>