Microsoft® Windows® Script Host Item Property |
WSH Reference Version 1 |
Returns a specified item from a collection.
object.Item(natIndex)
Part Description object The result of the EnumNetworkDrive or EnumPrinterConnections methods, or the object returned by the Environment or SpecialFolders properties. natIndex Item to retrieve.
Item is the default property for each collection. For EnumNetworkDrive and EnumPrinterConnections collections, index is an integer; for the Environment and SpecialFolders collections, index is a string.WshShell.SpecialFolders.Item("strFolderName") returns NULL if the requested folder (strFolderName) is not available. For example, Windows 95/98 does not have an AllUsersDesktop folder, and returns NULL if strFolderName = AllUsersDesktop.
The following table lists special folders and the version of Windows in which they are provided:
Folder Windows version AllUsersDesktop Windows 2000 AllUsersStartMenu Windows 2000 AllUsersPrograms Windows 2000 AllUsersStartup Windows 2000 Desktop Windows 95/98, Windows 2000 Favorites Windows 95/98, Windows 2000 Fonts Windows 95/98, Windows 2000 My Documents Windows 95/98, Windows 2000 NetHood Windows 95/98, Windows 2000 PrintHood Windows 95/98, Windows 2000 Programs Windows 95/98, Windows 2000 Recent Windows 95/98, Windows 2000 SendTo Windows 95/98, Windows 2000 Start Menu Windows 95/98, Windows 2000 StartupB Windows 2000 Templates Windows 2000
The following example outputs the drive letters and network mappings:
Set WshNetwork = WScript.CreateObject("WScript.Network") Set oDrives = WshNetwork.EnumNetworkDrives For i = 0 to oDrives.Count -1 WScript.Echo oDrives.Item(i) Next