问题
This is a follow-up question to Where are my environment variables set?. In that post it's mentioned how one can find environment variables using the Windows GUI or RegEdit. What's strange to me is that SET
from the command line displays a USERPROFILE=C:\Users\brianjd
but it doesn't show up using the Windows GUI or RegEdit methods.
Q: Where is USERPROFILE
? Why does it show up using SET
but doesn't show up using Windows GUI or RegEdit?
回答1:
I think you may find what you need in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory
Each user has it's own Profile key as well, which stores the ProfileImagePath (and is set to the same value as %userprofile%
)
It may explain why this is not a environment variable that appears in the GUI.
I don't have any source to confirm that sorry. But I had to use this to repair a broken profile last week. Hope it helps.
M'vy
回答2:
I'm guessing it is set by winlogon.exe or userinit.exe when you log in. Clearly, the USER* variables have to be set by the system since domain and profile path can change.
来源:https://stackoverflow.com/questions/5146842/where-is-userprofile-on-vista32