Windows Script Host  

WshArguments Object

Arguments PropertyWScript Object

Provides access to the entire collection of command-line parameters — in the order in which they were originally entered.

Remarks

The WshArguments object is a collection returned by the WScript object's Arguments property (WScript.Arguments). Two of the WshArguments object's properties are filtered collections of arguments — one contains the named arguments (querying this property returns a WshNamed object), the other contains the unnamed arguments (querying this property returns a WshUnnamed object). There are three ways to access sets of command-line arguments.

Example

The following code displays the command-line parameters in the WshArguments object.

[VBScript]
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
   WScript.Echo objArgs(I)
Next
[JScript]
objArgs = WScript.Arguments;
for (i = 0; i < objArgs.length; i++)
{
   WScript.Echo(objArgs(i));
}

Properties

Item Property | Length Property (WshArguments object) | Count Property | Named Property | Unnamed Property

Methods

Count Method | ShowUsage Method

See Also

Arguments Property | WshNamed Object | WshUnnamed Object