How to add an environment variable on Windows? – check how it’s easy is in 2 minutes!

How to add an environment variable on Windows?
Share this post and Earn Free Points!

To add an env variable, start the Start Menu and depending on whether you have set the PL or ENG language [ How to add an environment variable on Windows ] in Windows enter the appropriate phrase: “edit the system …”

In this post I will show you step by step how to change the environment variable on Windows 10 or Windows 11. Basically it doesn’t matter which version you have, the approach is similar.

What Is Windows?

Windows is an operating system developed by Microsoft that is designed to run on personal computers, laptops, and other devices. It provides a graphical user interface (GUI) and a range of features and programs that allow users to perform a wide variety of tasks, such as creating and editing documents, accessing the Internet, and running applications. There have been several versions of Windows released over the years, with the most recent being Windows 10. Windows is known for its ease of use, flexibility, and wide range of applications and features that are available for it.

What Is Environment Variable

In Windows, an environment variable is a piece of information that is stored within the operating system and can be accessed by computer programs. Environment variables consist of a name and a value, and they can be used to store various types of information such as the path to a directory or the version of an application.

There are two types of environment variables in Windows:

  1. System variables: These variables are set by the operating system and are available to all users on the computer.
  2. user variables: These variables are specific to a user account and are only available to the user who created them.

To view and manage environment variables in Windows, you can use the “Environment Variables” button in the “Advanced” tab of the “System Properties” window. From here, you can add, edit, or delete environment variables as needed. You can also use the “SET” command in the command prompt to view and modify environment variables.

Environment variables can be useful for storing information that is used frequently by multiple programs or scripts, such as the path to a directory or the location of an executable file. They can also be used to customize the behavior of certain programs or scripts by setting specific values for certain variables.

Add An Environment Variable On Windows

To add an environment variable on Windows, follow these steps:

  1. Press the Windows key + R to open the Run dialog.
  2. Type “control panel” and press Enter.
  3. In the Control Panel, search for “environment variables” and click the “Edit the system environment variables” button.
  4. In the System Properties window that opens, click the “Environment Variables” button.
  5. Under the “User variables” section, click the “New” button.
  6. In the “Variable name” field, enter the name of the environment variable you want to create.
  7. In the “Variable value” field, enter the value that you want to assign to the variable.
  8. Click the “OK” button to create the environment variable.

Add Environment Variable Windows 10

How to add an environment variable on Windows? - check how it's easy is in 2 minutes!
Environment Variables Windows 10

In the next window, click on the Environment variables button.

How to add an environment variable on Windows? - check how it's easy is in 2 minutes!
Env Variables Windows

We will open a window with environmental variables. The red frame is marked by variables that are defined as the active user, and below in the green frame there are global variables, i.e. those that are visible and active for all users.

How to add an environment variable on Windows? - check how it's easy is in 2 minutes!

We click “New” and a window will appear, where we will enter the name of the new env variable and its value. I created a variable named HADOOP_HOME.

How to add an environment variable on Windows? - check how it's easy is in 2 minutes!

Click OK and our env variable is already visible in the list.

How to add an environment variable on Windows? - check how it's easy is in 2 minutes!

Alternative Solution

Alternatively, you can use the “setx” command to create or modify an environment variable from the command prompt. To do this, open a command prompt window and type the following command:

setx VARNAME "VARVALUE"

Replace “VARNAME” with the name of the environment variable you want to create and “VARVALUE” with the value that you want to assign to the variable. The “setx” command will create the environment variable if it doesn’t already exist, or it will overwrite the existing value if the variable already exists.

Note that the changes made to environment variables using the “setx” command will not take effect until you open a new command prompt window or log off and log back in.

Summary

In some cases it will be required to restart the program so that the env variable is read again. It all depends on the logic of the target software for which the given env variable was created. That’s all about How to add an environment variable on Windows!

Could You Please Share This Post? 
I appreciate It And Thank YOU! :)
Have A Nice Day!

How useful was this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 387

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?