Editing your PC’s environment variables can save you time in Command Prompt and make your scripts more concise. It allows you to change the location of files stored by Windows. You can learn how to edit them.
How Environment Variables work
Environment variables can be used for pointing to or setting important directories such as the Windows Temp folder. They can also relay important information about your computer, such as the version of Windows it’s running and the number of processor cores available. Any program or script running on your computer can access the environment variables. You can create environment variables for individual user accounts or for the entire system.
One environment variable worth noting is the Path variable. Path is a variable that specifies which folders are checked for executables whenever a command is executed in a terminal or script. Take Notepad as an example — you can type Notepad
You can launch it immediately by entering Command Prompt You can also type chrome
, however, you’ll get an error message. The error occurs when the Notepad executable is located in a Path folder, but the Chrome executable not.
Path defaults to only a few Windows folders. However, you can easily add more.
Warning:Your PC may malfunction if you modify environment variables. If you’re going to add, edit, or delete an environment variable, be sure to double-check what it is you’re doing.
How to Edit Environment Variables
While there are minor differences in the user interfaces for Windows 10 and Windows 11, the basic process of editing the environment variables is the exact same.
To configure your environment variables, click the Start button, then type “environment properties” into the search bar and hit Enter. In the System Properties window, click “Environment Variables.”
Click on the variable you’d like to change, click “Edit.”
Many environment variables will simply take a name and value, like “Number of processors.” All you have to do to edit them is to change the value, and click “OK.”
The process of adding an environment variable is the same, except that you must specify its name and value. You can have multiple values for the variable value, but you must separate them by semicolons. Once you’ve named your variable and assigned a value, click “OK.”
Some environment variables, such Path, can look a bit different, but they work exactly the exact same way. The Path variable can be used to add, edit, delete entries.
You can add another folder to the Path by clicking “New,” and then specifying the folder.
RELATED: How to Move Windows’ Temporary Files to Another Drive
If you write a lot of batch or PowerShell scripts, or frequently use non-Windows command-line applications, it is probably worth the effort to customize your environment variables — you’ll save a ton of time in the long run.