Provided here you will find a VBS script example of how to enumerate local machines specified special folder content. To make the script more robust I have added all of the available Special Folder Constants (Const) so that the script can be modified and reused.
The script below will list the contents of the DESKTOP special folder. To use any of the Constants in the list copy and paste the special folder you want to use and substitute the DESKTOP Constant name in the Namespace line with any of the Const values contained in the script as in the examples here:
Set objFolder = objShell.Namespace(LOCAL_SETTINGS_HISTORY)
Set objFolder = objShell.Namespace(MY_PICTURES)
Set objFolder = objShell.Namespace(MY_RECENT_DOCUMENTS)
VBS Script:
Const LOCAL_SETTINGS_HISTORY = &H22&
Const MY_PICTURES = &H27&
Const MY_RECENT_DOCUMENTS = &H8&
Const MY_COMPUTER = &H11&
Const NETHOOD = &H13&
Const PROGRAMS = &H2&
Const PROGRAM_FILES = &H26&
Const RECYCLE_BIN = &Ha&
Const SYSTEM32 = &H25&
Const STARTUP = &H7&
Const START_MENU = &Hb&
Const ADMINISTRATIVE_TOOLS = &H2f&
Const ALL_USERS_APPLICATION_DATA = &H23&
Const ALL_USERS_DESKTOP = &H19&
Const ALL_USERS_PROGRAMS = &H17&
Const ALL_USERS_START_MENU = &H16&
Const ALL_USERS_STARTUP = &H18&
Const APPLICATION_DATA = &H1a&
Const SENDTO = &H9&
Const COMMON_FILES = &H2b&
Const CONTROL_PANEL = &H3&
Const DESKTOP = &H10&
Const FONTS = &H14&
Const COOKIES = &H21&
Const FAVORITES = &H6&
Const LOCAL_APPLICATION_DATA = &H1c&
Const MY_NETWORK_PLACES = &H12&
Const MY_DOCUMENTS = &H5&
Const MY_MUSIC = &Hd&
Const NETWORK_CONNECTIONS = &H31&
Const PRINTERS_AND_FAXES = &H4&
Const PRINTHOOD = &H1b&
Const MY_VIDEOS = &He&
Const TEMPLATES = &H15&
Const TEMPORARY_INTERNET_FILES = &H20&
Const USER_PROFILE = &H28&
Const WINDOWS = &H24&
Const INTERNET_EXPLORER = &H1&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(DESKTOP)
Set colItems = objFolder.Items
For Each objItem in colItems
MsgBox objItem.Name
Next
No Comments