Reputation: 2788
I have a requirement where in which,
Lets say
SETX home %UserProfile%
This will set
home= C:\Users\AAA
and same we can see in env variables.
echo %home%
, this user will not have home env,
i wish to get home=C:\Users\BBB
here also without using SETX
again.Please suggest me the solution, How to set one user variable that should persist across any user he login to machine.
Note: It should not be system variable.
Please share your thoughts.
Upvotes: 0
Views: 290
Reputation: 1
A bit too late, but for anyone searching ... "home" is not a "native" variable for windows, then, you must set it. In the thread the user maked it by SETX home=%UserProfile%
SETX make it "public" for other sessions/programs that will use it. NOT FOR other user.
That said, each user must set this variable at logon (or other point before run programs that use it). The simplest way i found is: Task Scheduler -> new task -> trigering/event [AT USER LOGIN] -> command/program: SETX home=%UserProfile%
I not sure if it works if the user is not an administrator. Workaround:
Upvotes: 0
Reputation: 26150
Whitout being a system (machine) variable, the environment variable is a per user setting (store in HKCU in the registry), it won't be accessible by another user.
Upvotes: 3