问题
What is the exact path to %allusersprofile% folder in Windows Vista? On some systems, I have seen the folder as 'c:\Users\All Users', on some it is mapped to 'C:\ProgramData', while on others it has been mapped to 'C:\Users\Public'.
If you can provide link to microsoft documentation reference would be highly helpful (so far I have been unable to dig the link out).
Edit: Registry settings do define the location of the folder. What I am looking for is more towards how Windows interprets/defines these folders at installation time? What is the default location of this folder as defined by Microsoft Windows Vista?
回答1:
This document on MSDN shows the new methods in Vista to locate known folders, including the one you ask about specifically: "C:\Documents and Settings"
.
I gather this can be changed simply by changing the registry (and moving the current directory).
回答2:
Why do you care? Just use the environment variable (or the KnownFolderId, that's guaranteed to work forever.
Microsoft might decide tomorrow to move the directory to another location - as long as you continue to use the environment variable you'll be ok.
If you hard code the value, your code will break in the future.
回答3:
I found these special folder location confusing sometimes. I created a sheet comparing the folder locations on Windows XP and Vista. That may be useful to you. Here is the link.
来源:https://stackoverflow.com/questions/784487/location-of-allusersprofile-folder-in-windows-vista