How do I get the path to the default user's profile?
A customer wanted to know how to get the path to the default user’s profile. On older versions of Windows, the default location of the default user’s profile was
C:\WINNT\Profiles\Default. Then it moved to
C:\Documents and Settings\Default User. Now it’s in
C:\Users\Default. And the location may have been customized, so in principle it could be anywhere.
The function to get the default user profile’s directory is is the deviously-named
But the reason I’m writing this article is not to call your attention to the
GetDefaultUserProfileDirectory function, but rather to something in the function documentation.
The documentation for the
GetDefaultUserProfileDirectory function includes the strings
C:\Documents and Settings\Default User and
C:\Users\Default, so all somebody had to do was type either of those paths into a search engine scoped to MSDN, and it would have found the function to use.
This sort of counts as a counterexample to the suggestion that in order to help people find the correct function to use (instead of whacking an undocumented registry key), MSDN should include the path to the registry key so that a search for the undocumented registry key will kick up a page that says, “Do not use this registry key. Call this other function instead.” That experiment was attempted (inadvertently) with the
GetDefaultUserProfileDirectory function, and it didn’t work.