There are tons of examples on the web how to set an environment variable for the current user. Is it possible to set an environment variable in windows for a different user (that does not have login rights?)
1 Answer
In the registry editor HKEY_CURRENT_USER is just an alias for the HKEY_USERS\$SID entry of the current user.
So, you only need to go to HKEY_USERS\$SID_OF_USER\Environment to set the variables there.
To get the SID of that user you can use this command:
wmic useraccount where name='username' get sid - nice! I suppose this also works for the domain users as well. Let me try this outarthur– arthur2020-12-09 08:24:10 +00:00Commented Dec 9, 2020 at 8:24
- As of 2024-05-24 on Windows 11,
wmic /?responds with "WMIC is deprecated."qxotk– qxotk2024-05-24 14:11:21 +00:00Commented May 24, 2024 at 14:11