Obtain the full path to any of the special Windows folders.
Syntax
strMyPath = WshShell.SpecialFolders("strFolderName")
or
strMyPath = WshShell.SpecialFolders.Item("strFolderName")
Arguments:
strFolderName : One of the following special folders
(not all are available to all flavors of Windows)
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
Returns:
strMyPath : The full path to the special folder
returns NULL if the folder is not available.
Examples
'Return the full path to the Windows Desktop:
Dim wshShell As Object
Dim strPath As String
Set wshShell = Wscript.CreateObject("Wscript.Shell")
strPath = wshShell.SpecialFolders("Desktop")
MsgBox strPath
'List all special folders:
For Each strFolder In WshShell.SpecialFolders
MsgBox strFolder
Next
"An artist who was once known as Prince
On the stage he would wiggle and mince
And then, for a giggle, He changed his name to a squiggle
And nobody's heard of him since" - Tim Brooke-Taylor
Equivalent Powershell command: via environment variables or (Get-WMIObject Win32_OperatingSystem).SystemDirectory