I am trying to set
HOME
to be%USEPROFILE%
for the currently logged on user. However, creating a system environment variableHOME
and setting to and setting it%USERPROFILE%
does not seem to work. After logging out and logging in as a non-administrative user, I havec:\ set ... HOME=c:\Documents and Settings\administrator HOMEPATH=c:\Documents and Settings\[user] ...In the Windows Environment Variables dialog, I have
HOME %USERPROFILE%but don’t see
HOMEPATH
anywhere. Can anyone tell me how to fix this?
Answer
It is a little unclear from your question, but it sounds like the problem is that the HOME
environment variable is being assigned the expanded value of %userprofile%
(c:\Documents and Settings\administrator
) at time of configuring it, rather than being stored as the string literal %userprofile%
which would be expanded after login.
It’s been a while since I worked with this sort of thing on XP, bu if I recall, permanent environment variables are stored in the registry.
set
usually only works in the current cmd session, so to get it to be across all sessions,there is a setx
util (from Microsoft) that will permanently set env variables.
One trick is to make a batch file which runs at startup (put it in the startup folder of all users
) which runs setx
. This will ensure that %userprofile%
expands to the currently logged in user’s profile.
Attribution
Source : Link , Question Author : Azim , Answer Author : horatio