Method:  WshArguments.Item

object[.Item] (lngIndex)

The Item method is the default method of the WshArguments object. It takes a single argument of type Long, and returns the element in the collection at the specified position. Indexing starts at zero. If there is no element at the requested index, a "Subscript out of range" error is generated.

The following VBScript code displays the first and second arguments passed to the current script. The output shown would be observed if the script were invoked with two command-line arguments: "abc" and "def". The example also illustrates both forms of syntax that can be used to call the default Item method.

Code:
WScript.Echo "The first argument is", WScript.Arguments(0)
WScript.Echo "The second argument is", WScript.Arguments.Item(1)


Output:
The first argument is abc
The second argument is def

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information