Item Property (WshNamed)

Provides access to the items in the WshNamed object.




  • Object
    WshNamed object

  • key
    The name of the item you want to retrieve.


The Item property returns a string. For collections, it returns an item based on the specified key. When entering the arguments at the command line, you can use blanks in string arguments if you enclose the string in quotes. Consider the following example:myscript.vbs /stringarg:"This string has spaces"

The quotes will be removed in the WshNamed collection. For an argument to be in the WshNamed collection, it must have been used on the command line. If the argument has no value (such as a simple argument or an empty string), the Item property returns an empty string. Requesting a non-existent named argument from the Item property causes an error. To check if an argument exists, use the Exists method.

Applies To:

WshNamed Object

In the following example, two named arguments are supplied to run a script. Inside the script, code causes the named arguments to be output. The Item property is used to index into the named arguments collection.

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

myScript.vbs /c:arg1 /d:arg2

If the following code is executed inside the script, then the output is:



WScript.Echo WScript.Arguments.Named.Item("c")
WScript.Echo WScript.Arguments.Named.Item("d")

See Also

WshUnnamed Object
Count Method (Windows Script Host)

Exists Method (Windows Script Host)
Bookmark link 'wslrfitemproperty' is broken in topic '{"project_id":"9fb4a69f-0172-4157-a999-d1266f74240f","entity_id":"f4b72d03-1714-4d0d-81c9-7b5dd6327e50","entity_type":"Article","locale":"en-US"}'. Rebuilding the topic '{"project_id":"9fb4a69f-0172-4157-a999-d1266f74240f","entity_id":"f4b72d03-1714-4d0d-81c9-7b5dd6327e50","entity_type":"Article","locale":"en-US"}' may solve the problem.