Learning About Computers and the Internet
Tips Blog WinXP Internet Computing Downloads Vista/7 Home

Constants for Special Folders in Windows
Certain folders that are generally present in Windows systems have been assigned constants for easier access by scripts. The constants are listed here.

There are a number of folders that are often accessed in system administration and for other purposes. These system or virtual folders are present on most Windows systems but not always with the same fully-qualified path. Thus it is convenient to have constants that can be used to represent the folder and its full pathname in scripts. In this way, standard system folders can be accessed without having to know the actual details of the exact configuration of a particular computer. The constants are given in the table below. Not all folders listed are present in every version of Windows. The Microsoft reference for these values is found here.

Special folder constants
Constant Special Folder

&H1&

Internet Explorer

&H2&

Programs

&H3&

Control Panel

&H4&

Printers and Faxes

&H5&

My Documents

&H6&

Favorites

&H7&

Startup

&H8&

My Recent Documents

&H9&

SendTo

&Ha&

Recycle Bin

&Hb&

Start Menu

&Hd&

My Music

&He&

My Videos

&H10&

Desktop

&H11&

My Computer

&H12&

My Network Places

&H13&

NetHood

&H14&

Fonts

&H15&

Templates

&H16&

All Users Start Menu

&H17&

All Users Programs

&H18&

All Users Startup

&H19&

All Users Desktop

&H1a&

Application Data

&H1b&

PrintHood

&H1c&

Local Settings\Application Data

&H19&

All Users Favorites

&H20&

Local Settings\ Temporary Internet Files

&H21&

Cookies

&H22&

Local Settings\History

&H23&

All Users Application Data

&H24&

Windows

&H25&

System32

&H26&

Program Files

&H27&

My Pictures

&H28&

User Profile

&H2b&

Common Files

&H2e&

All Users Templates

&H2f&

Administrative Tools

&H31&

Network Connections

Example of using special folder constants in a script

One of the ways that the folder constants are used is with the Shell Object. Here is a very simple example: Set objShell = CreateObject("Shell.Application")
objShell.open objShell.NameSpace(&H11&)
This code snippet opens My Computer by using the constant &H11&


 < Previous ©2002-2016 Victor Laurie    Home page >>