Tuesday, April 21, 2015

How do I set system environment variables in Windows 10?



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.


System


Then on the left side click About and select System info at the bottom.


About


In the new Control Panel window that opens, click Advanced system settings on the left.


Advanced system settings


Now in the new window that comes up, select Environment Variables... at the bottom.


Environment Variables


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...