Windows 脚本宿主  

Named 属性

返回 WshNamed 对象(命名参数集)。

Object.Named

参数

Object
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>

请参阅

WshArguments 对象 | WshNamed 对象 | Unnamed 属性