How to Set User Environment Variable Using Setx in Windows 10

If you’re logged in as standard user in Windows, you may not be able to set user environment variables via the user interface. This is due to a bug in Windows 10 where clicking "Change my environment variables" link in the User Accounts Control Panel doesn’t work.

Update: 3-August 2016 – The "Change my environment variables" link has been fixed in Windows 10 Anniversary Update (also known as Redstone 1) build. If you’re still using an earlier build you need to set the environment variable using Command Prompt, as mentioned below.

The following command-line is executed when you click the link, but it has no effect in Windows 10 v1511 and earlier, whether you run it as standard user or administrator.

rundll32 sysdm.cpl,EditEnvironmentVariables

Alternately, you can use the Setx command to set user environment variables.

Setting User Environment Variable

Open a Command Prompt window and type SETX /? to know the command usage. For example to set the JAVA_HOME variable, you would use:

SETX JAVA_HOME "C:\Program Files\Java\jdk1.6.0_02"

(Depending upon the version of the JDK installed, bitness of your OS, change the JDK folder path accordingly.)

This permanently sets the environment variable for your user account, and takes effect for future Command Prompt windows.

Command Prompt

Delete a User Environment Variable

To clear the user variable, use this syntax/example:


This however, doesn’t delete the value from the following registry key:


So you need another command to clear it, although this is optional.


This clears the JAVA_HOME user variable.

Note: Setx can also be used to set System Environment Variables using the "/M" switch, but you need to run it from elevated or administrator Command Prompt.

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Leave a Comment