Environment Variables are an essential part of the Windows operating system. The variables are mostly useful for command line usage and also in scripts. As an example: when you type a program name on the command line, e.g., notepad.exe, Windows searches the variables to find the application.
System environment variables determine locations for certain folders as well. The temporary files folder, for instance, is set using the temp variable. Apart from path information, variables may also provide information to programs. They may reveal the operating system’s name, the architecture or the number of processors.
Environment variables are available as user and system variants. The main difference is that the former applies only to the logged in user while the latter to all users of the system.
Editing System Environment Variables on Windows
All versions of Windows include an editor for system variables. It is a rather basic tool that has not been updated in a long while.
The following instructions explain how to launch the editor on any version of Windows and how to use its functionality.
Follow these steps to launch the Editor:
- Open the Start Menu.
- Type env.
- Select the “Edit the System Environment Variables” result. The System Properties window opens.
- Activate the Environment Variables button.
The following program window opens.
Windows separates user and system variables in the interface. Options to add variables, edit or delete existing ones are provided.
A double-click opens the edit interface. You may select a line and then edit alternatively. Opening Path this way, you’d end up with the following editing interface:
All basic options are available. You can add, edit and delete variables here. A double-click lets you edit the selected variable right away.
Note that the order is important as well. Windows goes through the locations from top to bottom.
Use the “move” options to change the priority of path variables.
A click on new lets you add new folder locations to the variable. These are added to the bottom by default, but you can use move to change the priority after creation.
Adding locations to path is useful for development, users who create script files regularly, and also users who run programs from the command line often.
Security-wise, it is a good idea to check path variables as well. Remove any variable that you don’t require. Some programs and also malware may add variables to the path variable.
Edit Environment Variables from the command line
You can list and edit variables using a command prompt. Launch a new command prompt window by opening Start, typing cmd.exe and pressing the Enter-key.
Type set and press Enter to display all environment variables. To change a variable name, run the command setx NAME “VALUE”, e.g. setx TEMP “e:\temp”, to set the new TEMP folder location to e:\temp.
System Environments of note
Some environment variables are more important than others. Here is a quick overview of important variables and their functionality:
- Temp and Tmp — These point to the temporary folder used by the system. Windows and apps store temporary files in the folder. You could edit the path to point it elsewhere. One interesting option is to set the path to a ramdrive location. Doing so would erase temporary files automatically on every shutdown.
- Path — The path variable is used for a variety of purposes. It defines the locations that Windows looks in when you try to run executable files. Most native Windows tools, notepad, paint or wordpad, are launched when you type their name in a command prompt. Third-party apps, like firefox or chrome, are not however. The reason is simple: their location is not included in the path variable. You can edit the Path variable to add more locations.
Third-party editors
Third-party tools may be used to edit variables. These may offer additional features that the native editor lacks. Notable are support for backups, error checking, or selecting paths visually instead of typing them.
- Rapid Environment Editor — A free tool to manage system environment variables on Windows. Last updated in 2018, it works well with any version of Windows. Notable features include backups, error checking, visual path selecting, a variable inspector and support for editing paths of any user on the system.
- Windows Environment Variables Editor — the last update dates back to 2014, but it still runs fine on Windows 10 and 11 systems. It is not as powerful as Rapid Environment Editor.
- Microsoft PowerToys — Microsoft added a System Environments Variables editor tool to PowerToys 0.75. It offers a cleaner interface, but lacks advanced features.
Now You: how do you edit variables on Windows?