How to Create and Modify Environment Variables on Windows?

First, let’s understand what Windows environment variables are, they are Key-value pairs a system uses to set up a software environment known as Environment variables. These variables play a pivotal role in many installations, such as the installation of Java script on a PC.

7 Steps to Create or Modify Environment Variables on Windows

Step 1: Right-click the Start button and select System.


Step 2: In the left-hand pane, click Advanced system settings.

Step 3: In the System Properties window, click the Advanced tab.



Step 1: Windows + R to start the Windows Run prompt.

Step 2: Enter sysdm.cpl and choose OK.

Step 3: Run the Advanced tab and select the Environment Variables option in the System Properties window.

Step 4: The Environment Variables tab is divided into two tabs. The sections show user-specific and system-wide environment variables.


Step 5: To add a New variable, tap on the New option under the appropriate section.

Note: Under the System variables or User variables section, select the environment variable you want to modify and click Edit.

Step 6: Type the variable name and value under the New User Variable prompt.


Step 7: Click on the OK option.

Note: The process for setting environment variables in Windows 8, 10, and 11 are the same.

There is one minor difference between Windows 8 and Windows 10/11. To add server environment variables in Windows 8, you need to right-click on the Computer icon on the desktop to open the System Properties window. In Windows 10/11, you can also open the System Properties window by pressing the Windows key + X and selecting System.


It is a powerful tool for configuring and managing applications in Windows. By using environment variables, you can make your applications more portable and easier to deploy to different environments.


How do I set the environment variables on the Windows 10 command line?

To set an environment variable in Windows 10 using the command line, you can use the set command. The set command takes two arguments: the name of the environment variable and the value you want to assign to it.

How do I check environment variables on Windows 10 cmd?

To check environment variables on Windows 10 using the Command Prompt (cmd), you can use the echo command along with % signs to access specific environment variables. Additionally, you can use the set command to display a list of all environment variables.

How many user variables should I have in environment variables windows?

An environment variable’s theoretical maximum length is roughly 32,760 characters. In practice, though, you are unlikely to reach that theoretical maximum. All environment variables must be included within a single environment block, which has a character maximum of 32767.27.