236

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.)

4
  • It's almost the same as the previous versions of Windows...
    – MC10
    Aug 2, 2015 at 19:47
  • 2
    This last time this was asked, this happened: superuser.com/questions/601526/… so you should look at this: superuser.com/questions/284342/…
    – MC10
    Aug 2, 2015 at 19:50
  • 2
    Note, none of the answers work if you're not running an admin account and want to add an environment variable to that non-admin account.
    – casperOne
    Feb 28, 2016 at 8:37
  • Have an admin account or need to edit global environment [1] or [2]. Have a non-admin account and need to edit your environment [3].
    – user319780
    Apr 25, 2019 at 15:52

9 Answers 9

174

Update: After seeing lots of comments about setting environment variables without admin in Windows 10, I think I have found a way. I was not admin and could use PowerShell.

PowerShell method

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

9
  • 17
    That doesn't work if you aren't administrator.
    – Ira Baxter
    Jul 16, 2016 at 23:27
  • 9
    There is a direct path in a more recent Windows 10: in the main Settings window, just type "Path" into the search box and options to jump straight to the variable editors will appear. Saves a few steps of clicking. Oct 26, 2017 at 18:48
  • 3
    After the new Windows update, System info is missing from the About section
    – Iter Ator
    Dec 1, 2017 at 18:51
  • 1
    How to activate this? I can logout, is there a better way in the terminal?
    – Soerendip
    Feb 7, 2018 at 14:42
  • 2
    Or maybe just run SystemPropertiesAdvanced.exe which doesn't involve needing to find the Control Panel first...
    – TOOGAM
    Oct 2, 2018 at 11:27
127

Still the same as ever: It’s in the old-style control panel’s “System” thingy. You can reach it with WinBreak or by right-clicking the Start button.

From there, select “Advanced system settings” → “Environment Variables”.

Or you can do it the hard way and find some other entry point to the old-style control panel, like the Network and Sharing Center or the Desktop folder(!).

3
  • 23
    This method is only applicable to accounts from Administrators group. It is not possible to change environment variables of a regular User level account using this method. Nov 18, 2015 at 6:28
  • 1
    It's funny what cannot be easily found, when the little Computer icon is no longer on the desktop. Feb 17, 2017 at 14:27
  • 1
    On my system, the PATH environment variable allows editing, but PowerShell truncates the value after 2542 characters. However, it appears to retain the entire list of paths internally, so even though you can't see the entire list of paths from the prompt, it uses the entire list to find commands.
    – Suncat2000
    Jun 15, 2017 at 18:55
109

I typed "envir" in the "Search the web and Windows" box and selected "Edit environment variables for your account" under the "Best Match"

enter image description here

8
  • 24
    It works for me
    – Alex Szabo
    Dec 15, 2015 at 13:20
  • 6
    @Alex Szabó: I was wrong when I said "no longer produces such result". The serach result are indeed the same. But clicking of the first result (highlighted in your picture) in current Windows 10 does nothing for non-admin accounts. It is a "dead link". This is the same bug, introduced by 1511 update as the one described in my answer. So no, it doesn't really work in general case. Jan 15, 2016 at 15:18
  • 2
    The bug that AnT describes has been patched.
    – Nick
    Jul 17, 2016 at 13:18
  • 1
    The bug that Ant describes is back as of 2016-07-20. Jul 20, 2016 at 18:58
  • 4
    This is the answer. If you are using another language, you must type the equivalence in that language (in my case Chinese/Spanish). Type "variable del sistema" when you set Spanish as your preferred language, or “系统变量” when you use Chinese. It's there. You cannot miss it.BTW, it applies to all the searching work in this searching bar, and when you cannot find the Control Panel, you can type "control panel"/ "panel de control"/“控制面板” there. It's well designed.
    – WesternGun
    Apr 10, 2017 at 17:49
34

If by "system environment variables" you refer specifically to system-wide environment variables, then other answers have already covered this. However, if you want to edit both system-wide and user-specific environment variables then most (if not all) of these answers are inapplicable in general case.

Going through "System" and then “Advanced system settings” -> “Environment Variables” will only work for accounts from Administrators group, because only such accounts have access to “Advanced system settings”.

If you attempt do that from a regular user account, then trying to access “Advanced system settings” will trigger an UAC prompt asking you for administrator password. If you enter the password, “Advanced system settings” will successfully open, but any user-specific changes you make there will apply to the corresponding administrator's account (!), not to your original user's account.

In order to solve this problem (i.e. in order to give regular users the opportunity to edit their own environment variables) Windows provides another way to access the “Environment Variables” dialog.

Open Control Panel. Open User Accounts applet. On the left-hand side of that applet you will see a link that says Change my environment variables. Click that link, and it will take you to the same “Environment Variables” dialog for your user's environment variables.

enter image description here

If your user has administrator rights, you will be able to edit both sections of that dialog: user-specific environment variables (upper section) and system-wide environment variables (lower section). If you don't have administrator rights, you will only be able to edit the upper section: your own user-specific environment variables.

This is the proper way to edit environment variables in all post-UAC versions of Windows, not what is suggested in the majority of the answers above.


Unfortunately, Windows 10 November update (version 1511) destroyed this functionality. The Change my environment variables link no longer works. It is there, but it is dead. So for the post-November version of Windows 10 the correct answer is: it is generally impossible to edit user-specific environment variables in version 1511 of Windows 10 from regular user accounts. Microsoft has destroyed Windows 10 with this update and Windows 10 is now unusable. It will remain the case until they fix these ridiculous bugs in 1511 version of the OS.

For the time being one workaround for non-administrative accounts is to, well, add your user account to Administrators group, logout, log back in, edit the variables using "System" -> “Advanced system settings” method, and then take away administrative rights again...

An alternative workaround is to use PowerShell features as described here https://technet.microsoft.com/en-us/library/ff730964.aspx


Windows 10 Anniversary Update (version 1607) released August 2, 2016 finally fixed this bug.

7
  • 1
    As of today, this option works again. IMO you could remove the "not working" paragraph.
    – Steed
    Apr 21, 2016 at 14:31
  • @Steed: My Windows 10 Pro x64 is currently "Version 1511 Build 10586.218" and that option is still dead. What build do you have? Apr 21, 2016 at 14:54
  • Oh, sorry, my version is 10.0.10240 (Win 10 Pro x64), which should be older than yours. However, it's an up-to-date stock version with no updates pending in Windows Update. Maybe your one is Insider Preview or something?
    – Steed
    Apr 21, 2016 at 15:00
  • @Steed: No, mine is ordinary current public version of Windows 10 Pro. Meanwhile, your version number indicates that you are running the original Windows 10. You never installed update 1511 (aka "November update", aka "Threshold 2 update"). This is why you don't have this issue, since this issue, as I said in my answer above, was introduced by 1511 update specifically. If you update your Windows to the current version, you will observe the same problem. I don't know though why Windows Update is telling you that your version is up-to-date. Apr 21, 2016 at 15:55
  • 1
    @quetzalcoatl: Anniversary Update finally fixed this issue. Aug 6, 2016 at 23:03
25

Just hit Windows Key+R) at the same time to get command prompt. Then type sysdm.cpl, go to advanced and select Environmental Variables

enter image description here

4
  • 4
    This only changes environment variables for an admin. Jul 20, 2016 at 18:57
  • This is most straight forward answer which will bring you right to set up window.
    – jdhao
    Feb 7, 2018 at 13:35
  • Thanks man. I am admin but I cannot change the admin variables. Now I can!!!
    – Guilherme
    May 1, 2019 at 16:50
  • 1
    Direct command to "Environment Variables" window: rundll32.exe sysdm.cpl,EditEnvironmentVariables. Thanks to serverfault.com/a/351154 Jan 18, 2023 at 1:45
7

I also experience the problem described by many users in this thread, i.e. the link to the dialogue to set the environment variables of non-admin users is dead. As a simple workaround I have downloaded this nice tool:

http://www.rapidee.com/en/download

It is portable and requires no permissions to install, it is simple to use, and actually provides a better overview of the variables than the system dialogue anyway.

Hope this helps.

1
  • Rapid Environment Editor is a great and handy utility and before Windows 10, it used to be even a necessity, because in all versions of Windows prior 10, the UX of the Environment Variables dialog wasn't far from the total failure. For example, editing long multi-line strings (e.g. the PATH variable's content) in a short single-line text box. RapidEE has a good UI/UX and adds various features to make the management of environment variables (mainly those containing filesystem paths) easier and faster. Highly recommended, even though Windows 10 has (FINALLY!) slightly improved the dialog. May 8, 2021 at 8:56
5

If you are not afraid of the command line, you should check out the command setx.

I quote from its description:

Creates or modifies environment variables in the user or system environment. Can set variables based on arguments, regkeys or file input.

(Note that this command does not affect the current command shell's environment, only the environment of new processes, so you'll need to open a new command shell to see any changes.)

10
  • 1
    setx works, but, unfortunately, cannot delete environment variables. Jan 14, 2016 at 23:28
  • True, and I don't know how to do that, other than setting the variable to an empty value, which isn't really deleting it. On the other hand, it works from a regular account (i.e.: not in the Administrators group). If I haven't missed it, none of the answers provided so far work from a non-admin account.
    – fogbanksy
    Jan 26, 2016 at 21:18
  • PowerShell method (see link at the end of my answer) works from non-Admin account. Jan 27, 2016 at 1:27
  • @Ant: Incorrect; I edited the answer with how. Jul 20, 2016 at 20:04
  • @Lawrence Dol: Er... No. Setting an env variable to blank value and deleting an env variable are two completely different things (as @fogbank already noted above). One more time: setx does not support deletion of variables. Jul 20, 2016 at 21:40
4

I found at least one way:

In the "Search the web and Windows" box on the taskbar, type "environment variables" then select "Edit the system environment variables" then click "Environment variables"

1
  • 1
    A shorter equivalent to typing "environment variables" is typing "path" (yes, none of those titles contain "path", but it still works). Aug 16, 2019 at 5:42
2

In windows 10, changing the environment variables has not changed, It is the same as in windows 7: Right click on This PC (My Computer). Left Click Properties. Left Click Advanced system settings. Left Click Environment Variables...

At this point you can change the variables for the current user or the system

1
  • This is correct. "This PC" is under your File Explorer's left quick toolbar, it's not hidden, just needs patience to find it. That's why someone downvoted it and I see it not proper, thus the upvote from me.
    – WesternGun
    Apr 10, 2017 at 17:54

Not the answer you're looking for? Browse other questions tagged .