WSH » WshCollection » Count

Syntax:
object.Count ()

The Count method returns a Long value which is the number of items in the collection.

Examples

Code:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set clDrives = WshNetwork.EnumNetworkDrives()
For intI= 0 ToclDrives.Count - 1
    WScript.Echo clDrives.Item(intI)
Next
Output:
P:
\\FileServer\public
Q:
\\FileServer\upload
Explanation:

This VBScript code uses theCountmethod to set up a loop over the list of current network drives.

Language(s): VBScript

See Also: