1

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 1

2

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 
2
  • nice! I suppose this also works for the domain users as well. Let me try this out Commented Dec 9, 2020 at 8:24
  • As of 2024-05-24 on Windows 11, wmic /? responds with "WMIC is deprecated." Commented May 24, 2024 at 14:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.