Windows Script Host  

Item Property (WshUnnamed)

Returns an item using a zero-based index.



WshUnnamed object.
Associated with either a collection or a WshUnnamed object.


The Item property returns a string. For collections, it returns an item based on the specified key.

For the unnamed object, items are not named, so you cannot pass the name of the WshUnnamed argument.

The WshUnnamed argument items are stored in the order that they were included on the command line.

When entering the WshUnnamed argument at the command line, you can use blanks in string arguments if you enclose them in quotes.

The quotes are removed in the WshUnnamed collection.


The following example demonstrates how the Item property can be used to return items in the WshUnnamed collection. In this example, two unnamed arguments are supplied to run a script. Inside the script, code causes the unnamed arguments to be output. The Item property is used to index into the unnamed arguments collection.

The following line is typed at the command prompt to run the script.

myScript.vbs arg1 arg2

When the following code is executed inside the script:

WScript.Echo WScript.Arguments.Unnamed.Item(0)
WScript.Echo WScript.Arguments.Unnamed.Item(1)

the following output is produced:


See Also

Arguments Property | WshUnnamed Object | WshUnnamed Object | Count Method | Item Property (WshNamed) | Exists Method