Could somebody point me to a document which lists all the standard file locations in windows and what one should and shouldn't use them for. Something like
User Application Data -> %USERDIR%/AppData/Local/%VENDOR%/%APPLICATION%
and so forth.
Could somebody point me to a document which lists all the standard file locations in windows and what one should and shouldn't use them for. Something like
User Application Data -> %USERDIR%/AppData/Local/%VENDOR%/%APPLICATION%
and so forth.
Big Disclaimer
Do not ever use the hard paths to these locations. Only use the provided APIs (whether those APIs be standard Win32 APIs, the .NET APIs, whatever) to access them. Otherwise you run the risk of breaking on different versions and languages of Windows.
And that's a real risk -- they've changed those locations at least four times -- and that's just in what I can recall off the top of my head! Not to mention roaming profiles and other fun weirdness that can crop up.
Now that the big disclaimer is out of the way, where's the list? Wikipedia has it. Take some of the "first-appeared-in" with a grain of salt; I'm 90% sure I've seen some of these appear earlier than is claimed. I have shamelessly cut-and-pasted-and-reformatted their content below:
%USERPROFILE%\Application Data
%USERPROFILE%\Cookies
%USERPROFILE%\Desktop
%USERPROFILE%\Favorites
%windir%\Fonts
%USERPROFILE%\Local Settings\History
%USERPROFILE%\Local Settings\Temporary Internet Files
%USERPROFILE%\Local Settings\Application Data
%USERPROFILE%\My Documents (WinNT line)
C:\My Documents (Win98-ME)
%USERPROFILE%\My Documents\My Music
%USERPROFILE%\My Documents\My Pictures
%USERPROFILE%\My Documents\My Videos
%USERPROFILE%\Start Menu\Programs
%USERPROFILE%\Recent
%USERPROFILE%\SendTo
%USERPROFILE%\Start Menu
%windir%\system32
%USERPROFILE%\saved games
%USERPROFILE%\Templates
Never use the hardcoded values. Not only are their APIs to retrieve them, but some also have environment variables.
For instance, Windows XP has these environment variables:
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\[username]\Application Data
CommonProgramFiles=C:\Program Files\Common Files
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\[username]
ProgramFiles=C:\Program Files
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=%APPDATA%\Local Settings\Temp
TMP=%APPDATA%\Local Settings\Temp
USERPROFILE=C:\Documents and Settings\[username]
windir=C:\WINDOWS
Vista adds a few new environment variables, such as LOCALAPPDATA
, ProgramData
, and Public
The KnownFolderID on MSDN is the official list.
Look at SHGetFolderlocation() (XP) or SHGetKnownFolderIDList() (Vista/W7) on how to get the location of these folders properly.
A lot of the information can be found in the MSDN page for Special Folders: http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx. It's useful information in addition to John's answer
a lot of this changed with vista/7. see http://www.online-tech-tips.com/windows-vista/move-my-pictures-to-different-location/