Skip to content

Published: July 16, 2015 | Applies to:

Learn how to know about environment variables, change user and system environment variables in Windows 10 using registry manipulation.

Environment variables is not a new term in context to Windows 10. People have known them for years, as they are available in Windows series since older days of Windows XP. But still the fact is that many newbies to Windows aren’t aware of them. In this article, we’ll let you know about these variables and show the way to edit or modify them.

Basically, environment variables are strings that contain information such as drive, path, or file name. They control the behavior of various programs. For example, %windir% is an environment variable which when run in Command Prompt, opens the Windows folder under system root drive such as C:\Windows. There are two kind of environment variables a Windows operating system have. The first category is of user environment variables, which the user(s) and/or administrator(s), both can modify anytime. Second class is of system environment variables, which only system admin(s) can modify.

Keep in mind that the user environment variables are different for each user of a particular computer. The variables include any that are set by the user, as well as any variables defined by programs, such as the path to the location of the program files. While for system environment variables, administrators can change or add environment variables that apply to the system, and thus to all system users. During installation, Windows Setup configures the default system variables, such as the path to the Windows files.

How To Change User And System Environment Variables In Windows 10

1. Open administrative or elevated Windows PowerShell. For this search in Windows by term windows powershell, pick Windows PowerShell from search results, right click on it and select Run as administrator.

Recommended : Use Windows PowerShell to find Windows Experience Index on Windows 10

2. Next, in the Windows PowerShell window, type following cmdlet and press Enter key:

Get-ChildItem Env:

How To Change System And User Environment Variables In Windows 10

This cmdlet output will show you the list all environment variables available on your system. You can also edit or modify the variables in Windows PowerShell itself, but this would be bit technical. So for the sake of readers, I’ll show you much familiar way to edit these variables.

Registry Disclaimer: The further steps will involve registry manipulation. Making mistakes while manipulating registry could affect your system adversely. So be careful while editing registry entries and create a System Restore point first.

3. Press Windows Key + R and put regedit in Run dialog box to open Registry Editor (if you’re not familiar with Registry Editor, then click here). Click OK.

Windows 10 Registry Editor

4. In the left pane of Registry Editor, navigate to following registry key:

HKEY_CURRENT_USER\Environment

How To Change System And User Environment Variables In Windows 10

5. At this registry location as shown above, you can see there are two user environment variables by default. To add a new environment variable, right click on blank space in the right pane, select New -> Expandable String Value. Change the string name so created from New Value #1 to whatever you want to say the variable. Now, for existing variables, double click on the variable string to add or modify its Value data:

How To Change System And User Environment Variables In Windows 10

Put you desired Value data in Edit String window and click OK. In this way, you can add or modify user environment variables.

6. In order to modify system environment variables, navigate to following registry key and perform the registry manipulation as described in previous step:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

How To Change System And User Environment Variables In Windows 10

We’ve highlighted some important variables in the screenshot above. So in this way, you can add or modify system environment variables. You may need to restart your system, to make your changes effective.

List of environment variables in Windows 10

For your convenience, here is the complete list of environment variables in Windows 10.

ENVIRONMENT VARIABLES
VALUES (items in italic – variables)
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users\(user-name)\AppData\Roaming
%CD% Current directory full path
%CMDCMDLINE% Returns exact command line used to start current cmd.exe session.
%CMDEXTVERSION% Number of current command processor extensions.
%CommonProgramFiles% C:\Program Files\Common Files
%CommonProgramFiles(x86)% C:\Program Files (x86)\Common Files
%CommonProgramW6432% C:\Program Files\Common Files
%COMPUTERNAME% Technoyl-PC
%COMSPEC% C:\Windows\System32\cmd.exe
%DATE% Current date in format determined by Date command
%ERRORLEVEL% Number defining exit status of previous command or program
%HOMEDRIVE% C:
%HOMEPATH% C:\Users\(user-name)
%LOCALAPPDATA% C:\Users\(user-name)\AppData\Local
%LOGONSERVER% \\MicrosoftAccount
%NUMBER_OF_PROCESSORS% 1
%OS% Windows_NT
%PATH% C:\WINDOWS

C:\WINDOWS\system32

C:\WINDOWS\System32\Wbem

C:\WINDOWS\System32\WindowsPowerShell\v1.0

%PATHEXT% COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
%PROCESSOR_ARCHITECTURE% x86
%PROCESSOR_IDENTIFIER% x86 Family 6 Model 69 Stepping 1, GenuineIntel
%PROCESSOR_LEVEL% 6
%PROCESSOR_REVISION% 4501
%ProgramData% C:\ProgramData
%ProgramFiles% C:\Program Files
%ProgramFiles(x86)% C:\Program Files (x86)
%ProgramW6432% C:\Program Files
%PROMPT% Code for current command prompt format. Code is usually $P$G
%PSModulePath% C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
%PUBLIC% C:\Users\Public
%RANDOM% To get random number between 0 and 32767
%SessionName% When logging on directly to machine, returns “Console”.

When client connects via terminal server session, is combination of

connection name, followed by pound symbol {#} and session number.

%SystemDrive% C:
%SystemRoot% C:\Windows
%TEMP% C:\Users\(user-name)\AppData\Local\Temp
%TIME% Current time in format determined by Time command
%TMP% C:\Users\(user-name)\AppData\Local\Temp
%USERDOMAIN% Technoyl-PC
%USERDOMAIN_ROAMINGPROFILE% Technoyl-PC
%USERNAME% (user-name)
%USERPROFILE% C:\Users\(user-name)
%WINDIR% C:\Windows

Hope you find the article useful! Also learn how to scan your Windows 10 using Windows PowerShell.


SHARE: Facebook Google+ Twitter

2 Comments

  • Hey! Thanks for this. The link in Windows 10 for setting user environment variables doesn’t work, so this is now the only way to do it until that’s fixed. Just wanted to thank you and add that text so search engines point to your page as a solution. Thanks again.

  • Kapil Arya

    ^^ Glad it helped 😊

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    What's New


    Recent Comments

    • Kapil Arya : ^^ Happy to help ☺️...

      1 hour ago

    • frozen nerd : i also tried uninstalling avast, disabling all startup progr...

      5 hours ago

    • frozen nerd : i have a win 10 home OEM from ASUS tried this and got the ...

      5 hours ago

    • Darren : Thank you, Kapil! The first two netsh commands and reboot ju...

      7 hours ago

    • Charles : I followed your steps but got stuck at step 9 since I couldn...

      12 hours ago

    • Barry : Fantastic! You solved my problem with very clear instruction...

      13 hours ago


    Windows Group Policy Troubleshooting