The environment variables are the key-value pairs that act asinformation containersfor all the programs running on Windows. Simply put, they are the string variables an OS uses to manage all the apps and services.
Every application has its own set of environment variables, and it helps them determine where to install and store files. These variables contain names and values that help control the operational environment. Further, they have a significant effect and enableyour computer’s active processes.
Without environment variables, you’ll need to inform your scripts every time to find the same path to a specific file. But if you set a dedicated variable, the information becomes available everywhere.
How to Set Windows Environment Variables
In Windows, the environment variables are categorized into two –User and System. While the former deals with user-defined settings (user profiles, files, etc.), the latter contains the values used by the operating system.
In this section, you will learn how to set Windows environment variables via the graphical user interface, command line interface (Command Prompt and Windows Powershell), and Registry Editor. So, without further delay, let’s get right into them in detail.
Before setting up a Windows environment variable in the graphical user interface, you’ll need to navigate to the dedicated window:
Another way to open Environment Variables window is from the Control Panel utility. Kindly follow the below instructions on how you may do so:
Alternatively, you candirectly launch it from the Run dialogue boxby running the following command:rundll32.exe sysdm.cpl,EditEnvironmentVariablesAlso, this is possible from the Start menu, where you may search for “Edit the system environment variables” or “Edit environment variables for your account”.
Once the Environment Variables window pops up, go through the following guide to learn how to set the system environment variables on Windows 11:
you may select the system or user variable if you want to change its name or value. Then, press the Edit button, and proceed with the same steps as above. Likewise, to delete an existing environment variable, select it and choose Delete.
Another way to set Windows environment variables is from the built-in Registry Editor tool. In fact, this is the precise location where all the user and system values are stored. Here’s a quick guide on how to do it the right way:
To edit the value, simply double-select the variable and change it to an appropriate one. Furthermore, you may right-click and pick Delete to remove the environment variable permanently.
If you prefer CLI (Command Line Interface) over GUI, the good news is that you may use simple commands to set Windows environment variables. Although you can create both user and system variables, there’s no individual section to display each of them.
Follow the below steps to view, set, edit, and delete Windows environment variables using Command Prompt: