WSH » wshshell » SpecialFolders

Syntax:
WshShell.SpecialFolders

The SpecialFolders property is read only and returns a WshSpecialFolders object.

The SpecialFolders property returns a WshSpecialFolders object which can be used to access various Windows shell folders such as the desktop folder, the Start Menu folder and the personal document folder.

If strFolderName is unavailable, SpecialFolders returns NULL. 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

Examples

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWshSpecialFolders = WshShell.SpecialFolders
WSCript.Echo "My documents are in: " & objWshSpecialFolders("MyDocuments")
' Or to access the WshSpecialFolders object directly from the WshShell object
WSCript.Echo "My documents are in: " & WshShell.SpecialFolders("MyDocuments")
Output:
My documents are in: C:\WINNT\Profiles\theGuru\My Documents
My documents are in: C:\WINNT\Profiles\theGuru\My Documents
Language(s): WSH