Introduction
Editing the environment variables on your PC might help you save time in Command Prompt and make your scripts more succinct. It also allows you to change where Windows saves some files. Learn how to modify them here.
The Effects of Environmental Variables
Environment variables may be used to point to or change key folders, such as the location of the Windows Temp folder, or to communicate critical information about your computer, such as the version of Windows it is running or the number of processing cores it has available. Any software or script that runs on your computer may read environment variables. Environment variables may be set for individual user accounts or for the whole system.
The Path variable is an important environment variable to notice. When a command is performed in a terminal or a script, the path specifies which directories are searched for executables. Consider Notepad: if you enter notepad into Command Prompt, it will run instantly. However, if you type chrome, you will get an error notice. Because the Notepad executable is in a folder specified in the Path, but the Chrome executable is not, the issue occurs.
Path only links to a few Windows directories by default, but you may simply add more.
- Caution: Changing environment variables may cause your computer to malfunction. If you’re going to create, change, or remove an environment variable, be sure you’re doing it correctly.
Editing Environment Variables
The user interfaces of Windows 10 and Windows 11 change somewhat, but the essential method of modifying environment variables is the same.
Click the Start button, then enter “environment properties” into the search field and press Enter. Click “Environment Variables” in the System Properties box.
Click “Edit” after selecting the variable you want to alter.
Many environment variables, such as “Number of processors,” will simply accept a name and a value. You just need to alter the value and click “OK” to edit them.
Adding an environment variable is the same as adding a variable, only you must give the variable name and value. If you desire, the variable value may accept several values, but they must be separated by semicolons. After you’ve given your variable a name and a value, click “OK.”
Some environment variables, such as Path, have a somewhat different appearance but perform the same job. The Path variable is shown as a list of items that may be added, edited, or deleted.
By choosing “New” and then specifying the folder, you may add another folder to the Path.
If you often use non-Windows command-line apps or create a lot of batch or PowerShell scripts, it’s definitely worth the effort to tweak your environment variables – you’ll save a ton of time in the long run.