Returns the number of switches in the WshNamed or WshUnnamed objects.
object.Count
The Count method returns an integer value. The Count method is primarily intended for VBScript users. JScript users should generally use the length property instead.
The following example demonstrates the Count method using the WshNamed object. Begin by typing the following text at the Command Prompt.
myScript.vbs /c:"WSH is a wonderful thing" /s:"scripts are wonderful"
Next, add the following VBScript code.
For i = 0 to WScript.Arguments.Count-1
WScript.Echo WScript.Arguments.Named(i)
next i
Following is the result.
WSH is a wonderful thing scripts are wonderful
The following example demonstrates the Count method using the WshUnnamed object. Begin by typing the following text at the command line.
myscript.vbs "WSH is a wonderful thing" "scripts are wonderful"
Next, add the following VBScript code.
For i = 0 to WScript.Arguments.Count-1
WScript.Echo WScript.Arguments.Unnamed(i)
next i
Following is the result.
WSH is a wonderful thing scripts are wonderful
Arguments Property | WshNamed Object | WshUnnamed Object | Item Property | Exists Method | Length Property