All Properties
Method: WshSpecialFolders.Item
object[.
Item]
(lngIndex)
The
Item
method is the default method of the
WshSpecialFolders
object. It takes a single argument of type Long, and returns the element in the collection at the specified position. Indexing starts at zero. If there is no element at the requested index, a "Subscript out of range" error is generated.
A key string can also be used to access the items in the
WshSpecialFolders
. If the key string is an invalid key, a NULL will be returned. The following is the list of available special folders on various Windows OS. (Note: not all of the following special folders are available to all flavors of Windows).
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
The following VBScript code displays the path to the special folder "Desktop". The example also illustrates both forms of syntax that can be used to call the default
Item
method.
Code:
WScript.Echo "The path to Desktop is: ", WshSpecialFolder("Desktop")
WScript.Echo "The path to Desktop is: ", WshSpecialFolder.Item("Desktop")
Output:
C:\WINNT\Profile\User\Desktop
C:\WINNT\Profile\User\Desktop
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information