How do I set a system environment variable in Windows 10 (without using the registry editor)?
(Note: Other answers don't specifically address Windows 10 - at least not yet - and they leave off important steps - like how to open the control panel - that changed since previous versions of Windows.)
Answer
You can list all environment variables with: Get-ChildItem Env:
.
To get the value of a specific variable: $Env:PATH
, where PATH
is the name of the variable.
To set a variable: [Environment]::SetEnvironmentVariable("PATH", "C:\TestPath", "User")
, the first parameter is the name of the variable, the second is the value, the third is the level of.
There are different ways to work with environment variables and certain quirks with them in PowerShell so consult the link for details.
Old method (no longer available in newer Windows 10 updates, use PowerShell or see other answers)
Go into Settings and click on System.
Then on the left side click About and select System info at the bottom.
In the new Control Panel window that opens, click Advanced system settings on the left.
Now in the new window that comes up, select Environment Variables... at the bottom.
No comments:
Post a Comment