Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Scripting
Windows Script Host
WshArguments Object

  Switch on low bandwidth view
This page is specific to
.NET Framework 3.0

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

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

Wsh Arguments Object graphic

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.

  • 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 command-line parameters in the WshArguments object.

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));
}
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