Query the Registry for Directory Names

[This is preliminary documentation and subject to change.]

Requirement   (Designed for Microsoft® Windows® Logo)

Your application should not assume that directory names such as "My Computer" will be in English or will be unchanged by the user. Your application should query the registry directly to obtain the proper language-specific directory names.

Vendors should be aware that English versions of their applications might be installed onto non-English versions of Windows. In this instance, a search for the English language directory string "Program Files" would not be successful and would result in a failed installation.

For many standard folders, a qualified path can be obtained by calling the SHGetSpecialFolderLocation function with the appropriate CSIDL constant. The following standard folders are accessible in this way.

Standard Folder CSIDL Constant Name Hex
Alternate Startup folder (All Users profile, DBCS)
CSIDL_COMMON_ALTSTARTUP
0x1e
Alternate Startup ([user], DBCS)
CSIDL_ALTSTARTUP
0x1d
Application Data ([user] profile)
CSIDL_APPDATA
0x1a
Control Panel virtual folder
CSIDL_CONTROLS
0x03
Cookies folder
CSIDL_COOKIES
0x21
Desktop (namespace root)
CSIDL_DESKTOP
0x00
Desktop folder (All Users profile)
CSIDL_COMMON_DESKTOPDIRECTORY
0x19
Desktop folder ([user] profile)
CSIDL_DESKTOPDIRECTORY
0x10
Favorites folder (All Users profile)
CSIDL_COMMON_FAVORITES
0x1f
Favorites folder ([user] profile)
CSIDL_FAVORITES
0x06
Fonts virtual folder
CSIDL_FONTS
0x14
History folder
CSIDL_HISTORY
0x22
Internet Cache folder
CSIDL_INTERNET_CACHE
0x20
Internet virtual folder
CSIDL_INTERNET
0x01
My Computer virtual folder
CSIDL_DRIVES
0x11
Network Neighborhood root
CSIDL_NETWORK
0x12
Network Neighborhood directory
CSIDL_NETHOOD
0x13
Personal folder ([user] profile)
CSIDL_PERSONAL
0x05
Printers virtual folder
CSIDL_PRINTERS
0x04
PrintHood folder ([user] profile)
CSIDL_PRINTHOOD
0x1b
Programs folder (under Start menu in All Users profile)
CSIDL_COMMON_PROGRAMS
0X17
Programs folder (under Start menu in [user] profile)
CSIDL_PROGRAMS
0x02
Recent folder ([user] profile)
CSIDL_RECENT
0x08
Recycle Bin folder
CSIDL_BITBUCKET
0x0a
SendTo folder ([user] profile)
CSIDL_SENDTO
0x09
Start menu (All Users profile)
CSIDL_COMMON_STARTMENU
0x16
Start menu ([user] profile)
CSIDL_STARTMENU
0x0b
Startup folder (All Users profile)
CSIDL_COMMON_STARTUP
0x18
Startup folder ([user] profile)
CSIDL_STARTUP
0x07
Templates folder ([user] profile)
CSIDL_TEMPLATES
0x15

Folders can also be located using the following Windows NT environment variables.

Standard Folder or Location Environment Variable
System drive %SystemDrive%
System root directory %SystemRoot%
Windows folder %windir%
Program Files folder %ProgramFiles%
User's profile folder %UserProfile%
User's temporary folder %Temp%

Access to specific user profile folders, such as Application Data, should be obtained through SHGetSpecialFolderLocation rather than by relying on the standard English folder name (as in %UserProfile%\Application Data\).