Powershell Add System Variable

Hi everyone, I'm trying to add a system variable here using powershell: enter image description here

I tried using both methods of $ env: MyTestVariable = "My test variable." and However, none of them seem to add this section. I also tried restarting the computer to see if it affected it. I have looked through the technique along with countless other websites. Please, help!

+4
source share
1 answer

Launch PowerShell as an administrator (to obtain the necessary permissions to access the registry), then call the .Net infrastructure to install it:

[Environment]::SetEnvironmentVariable("MyTestVariable", "MyTestValue", "Machine")

NB. , PowerShell, .

+12

Source: https://habr.com/ru/post/1608609/


All Articles