Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Scripting
Windows Script Host
WshNamed Object
Collapse All/Expand All Collapse All
This page is specific to
.NET Framework 3.0

Other versions are also available for the following:
Windows Script Host
WshNamed Object

Provides access to the named arguments from the command line.

Wsh Named Object graphic

The Named property of the WshArguments object returns the WshNamed object, which is a collection of arguments that have names. This collection uses the argument name as the index to retrieve individual argument values. There are three ways to access sets of command-line arguments.

  • You can access the entire set of arguments (those with and without names) with the WshArguments object.

  • You can access the arguments that have names with the WshNamed object.

  • You can access the arguments that have no names with the WshUnnamed object.

The following code displays the number of named and unnamed command-line arguments.

<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>
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker