WSH » WshCollection » length

Syntax:
object.length

The length property is read only and returns a Long value which is the number of items in the collection.

Examples

Code:
WshNetwork = WScript.CreateObject("WScript.Network")
clDrives = WshNetwork.EnumNetworkDrives()
for (i=0; i<clDrives.length; i++)
{
    WScript.Echo(clDrives(i))
}
Output:
P:
\\FileServer\public
Q:
\\FileServer\upload
Explanation:

This JScript code uses the length property to set up a loop over the list of current network drives.

Language(s): JavaScript

See Also: