November 21st, 2013

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 Get­Default­User­Profile­Directory. But the reason I’m writing this article is not to call your attention to the Get­Default­User­Profile­Directory function, but rather to something in the function documentation. The documentation for the Get­Default­User­Profile­Directory 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 Get­Default­User­Profile­Directory function, and it didn’t work.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.