Windows 10 supports a number of legacy features from older versions of the operating system. One of those legacy features is the environment variable. Environment variables offer a useful way to control the way Windows operates with an extremely small footprint in terms of memory usage.
For example, one common environment variable is called PATH, which is simply an ordered text string containing a list of directories that Windows should look in when an executable file is called. The PATH environment variable allows users to quickly launch programs without having to know where those programs live on the hard drive.
Setting environment variables is very useful and, fortunately, very simple. In this article, we’ll go over how to find and set your environment variables in Windows 10.
- Once logged in to Windows, right-click the Windows button in the lower-left corner of your screen and click System from the Power User Task Menu that’s displayed on the screen.
- Under the System menu, you need to click the Advanced System Settings.
- If you can’t find Advanced System Settings there, type “advanced system settings” into the search box and hit return to bring it up.
- Once Advanced System Settings is open, click on the Advanced tab, then look on the bottom-right side for the Environment Variables.
- Next, to create a new environment variable, click New. You might need to make a System variable depending upon what you’re doing.
- A dialog box will pop up, allowing you to enter a new variable name and to set its initial value:
- New adds a new environment variable.
- Edit lets you edit whatever environment variable you have selected.
- Delete lets you delete the selected environment variable.
- Save any changes that you make by clicking OK.
How to Find the PATH Variable in Windows 10
- Under the Environment Variables window, choose or highlight the PATH variable in the System Variables section shown in the window.
- After highlighting the PATH variable from System Variables, click the Edit button.
- You can add or modify the path lines with the directories you want your computer to look in for executable files.
- You will find that each different directory is separated with a semicolon, for example:
C:Program Files;C:Winnt;C:WinntSystem32
- You will find that each different directory is separated with a semicolon, for example:
- There are other environment variables in the System Variables section that you can examine by clicking Edit.
- Likewise, there are different environment variables, such as PATH, HOME, USER PROFILE, HOME and APP DATA, TERM, PS1, MAIL, TEMP, and so on. These Windows environment variables are very useful and can be used in scripts as well as on the command line.
- Once finished, you can test your changes by opening a new PowerShell window and entering the following:
$env:PATH
Frequently Asked Questions
Here is some more information about Environment Variables for you:
How Do I Find Environment Variables in Windows 10?
To find environment variables in Windows 10, you can follow the steps described above to find the environment variable information tucked away inside the system’s advanced settings.
Alternatively, if you just need to see what the variables are but don’t need to change them, you can simply open a command-line interface by hitting Ctrl +Esc and typing “cmd” in the command box, then type “set” in the command window. This prints out all the environment variables that are set on your system.
Why Can’t I Edit the Environment Variables?
There are several reasons that you may not be able to set these variables.
1. The first of your problems could be that you don’t have Admin rights. To set or edit this function, you must be the Administrator of the system.
2. If you are the Admin, yet the edit function is greyed out, try accessing the Environment Variables by accessing the Control Panel from the Start menu. Click on Advanced System Settings, then click Environment Variables.
Final Thoughts
Windows 10 environment variables make it incredibly easy to take control of your Windows device and make it run more efficiently. To find and set environment variables in Windows 10, follow the simple steps laid out in this article to get started.
Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.
Send To Someone
Missing Device
Different programs and processes require different environments to run. On a single machine, Windows needs to make sure that all programs and processes can access the environments they need.
To do this, Windows needs to know the kind of environment every program requires to work. Windows must store this information somewhere for easier retrieval. Environment variables make that possible.
Environment variables are, in short, data storing mechanisms.
Let’s dig a little deeper to see how environment variables work and how you can create, edit, and delete them effectively.
What Are Environment Variables in Windows 10?
Environment variables are dynamic variables that store data related to creating different environments for different programs and processes.
To understand them better, let us take the example of a program that needs to use a built-in Windows tool to run.
For the program to use the tool, the program needs to know the tool’s location to access it. The program also needs to find out if it has permission to use the tool or not. Similarly, there are things that a program needs to know before it can use the tool.
So, a program can access all of this information by asking Windows. Windows then looks up environment variables (EVs) for this data and creates an environment in which that program can run.
In other words, EVs store data that is accessible to every program and process running on the system across all users. The data these variables store helps the programs run in the environment they were designed for.
Some of the most important EVs on Windows include PATH, HOMEPATH, and USERNAME. All of these variables contain values that any user and process of the system can access at any time. For instance, the USERNAME environment variable contains the name of the current user. Windows can look up this variable whenever it needs to find out the name of the current user.
How to Set Environment Variables in Windows 10?
First things first, if you want to set system-wide EVs, you need to have administrative privileges. So, if you are not the admin, inform your system administrator and ask for their help.
Now that you have admin privileges:
- Type Advanced system settings in the Start menu search box and select the Best match.
- In the System Properties box, click on Environment Variables to open the Environment Variables panel.
The EVs panel lists two types of variables depending upon your need. If you want to change EVs for the current user only and don’t want the changes to reflect system-wide, you will change User variables.
On the contrary, if you want system-wide changes, you will change System variables.
Let’s say you’ve just installed Java and want to add the java path to the EVs. To do this:
- Click on New under the User/System variables. This will open up the New User Variable box.
- Enter JAVA_HOME in the Variable name field and browse to the directory where you’ve installed Java to populate the path in Variable value.
Pressing OK will add the JAVA_HOME variable to the PATH variable.
How to Edit Environment Variables
To edit different environment variables, select any variable from the list. Then, press Edit. This will open up the Edit environment variable panel. Here you can create, delete, and edit variables.
From the list of variables, select the one that you want to modify and click on Edit. Afterward, you can change the variable value to anything you like.
You can also delete the variables in a similar fashion.
What Is the Windows PATH Variable and How Can I Change it?
In simple terms, the PATH variable is an address book of programs and commands on your computer. Whenever you have a new program on your computer that you want to run from the command line interface, you must specify its address in the PATH variable.
A thing to remember here, not all programs are in the PATH environment variable. Only the programs that are meant to be used from the command line interface appear in the PATH variable. So, programs intended to be used from a Graphical User Interface don’t have their addresses in the PATH variable.
The way the process works involves Windows looking up the address for a certain command. Whenever you issue a command on a command line, Windows first searches the current directory for the command. If the OS can’t find it in the current directory, it looks up the PATH variable to find the address.
To enter an address in the PATH variable, the process is the same as before. Open up the Environment Variable box, select the PATH variable, and click on Edit.
In the Edit box, you can add, remove, and edit directories.
One final thing to remember, the PATH variable is not the same for every user on a system. So different users can list different directories without changing the variable for every user. So, if you want a tool to be available for every user, you have to edit the PATH variable under the System Variables.
Environment Variables in Windows 10 Store Data that Programs Need to Work
Programs need data to work. To make sure that data is available efficiently, Windows stores this data in global variables that all programs can access. These global variables are Environment Variables.
You can add, edit, and remove Environment Variables inside the Advanced System Settings panel.
Furthermore, if you have more than one user on a machine, user Environment Variables will be different for each user. For instance, one user may have listed a command under the PATH variable that won’t be available for other users.
On the other hand, system EVs are available for all users. These variables require admin privileges to edit or delete.
In short, EVs are Windows’ way to store important data. So, be sure you know what you are doing before modifying them.
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.
Page Contents
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:
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 + 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.
4. In the left pane of Registry Editor, navigate to following registry key:
HKEY_CURRENT_USER\Environment
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:
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
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.
RELATED ARTICLES
Environment variables are values that contain all the information regarding the system environment. Every process within the Windows OS has a block that contains a set of environment variables and their values. There are two kinds of environment variables, namely User Environment Variables and System Environment Variables. As the name suggests, user environment variables are set for each user, while system environment variables apply to everyone using the system.
Any user working with the command prompt or batch scripts will be well aware of environment variables due to the repetition of values. Every environment variable has two parameters: name and value. Therefore, you can edit or create your own environment variables to make your work easier. In this guide, I will discuss the ways to edit environment variables in Windows 10.
Editing Environment Variables.
In order to edit environment variables, follow the steps below to access them.
Navigating to Environment Variables Using the Command Prompt:
1. If you want to have access to both the variables, i.e., user and system variables, then open an elevated Command Prompt by right-clicking on the Start Menu icon and selecting Command Prompt (Admin) from the list.
2. While inside the command prompt, type or copy/paste the following command provided below. You can paste the command by right-clicking inside the Command Prompt and selecting ‘Paste.’ Press the Enter key to execute the command.
Command: rundll32.exe sysdm.cpl,EditEnvironmentVariables
3. After pressing Enter, the Environment Variables window will pop up, featuring a section for User Variables and another for System Variables.
4. To edit a variable, select the desired variable and press the Edit button to change its name. After making adjustments, press OK.
5. If you want to create a new environment variable for yourself, then click on the “New” button, and type the name and value for that particular variable, followed by clicking “OK.
Navigating to Environment Variables Manually.
1. Press the Win + X keys on the keyboard and select ‘System’ from the list.
2. Inside the System window, click on Advanced System Settings located in the left pane.
3. Within the advanced system settings, click on the Environment Variables button at the bottom, and follow the same procedure to edit environment variables as described above.
Kevin Arrows
Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.