How to Add Environment Variable in Windows 10

Windows 10 lets you change or add custom environment variables. Here’re the steps to add environment variable in Windows 10.

Windows has several different built-in environment variables to open folders, directories, and running processes. Some of the built-in variables include but not limited to TEMP, userprofile, windir, prefetch, etc. In fact, Windows even creates some custom environment variables for its own applications. For example, to open the OneDrive folder, you can simply execute the “OneDrive” command in the Run window. This happens because OneDrive created a new environment variable in the background.

If you have a directory or process that you want to open with a dynamic value, you can add an environment variable for that. For instance, I have a custom variable to open my downloads folder. This makes it easy to access the folder in custom scripts and other applications. I don’t have to worry about the actual folder location as long as it is properly configured in the environment variable.

In this quick and simple guide, let me show you the steps to add environment variable in Windows 10.

Steps to Add Environment Variable in Windows 10

To add a new environment variable, follow the steps listed below.

  1. Open the Start menu by pressing the “Windows Key”.
  2. Type “Environment variables” and click on the “Edit the system environment variables” result.
    Open-environment-variables-270820
  3. Click the “Environment variables” button under the “Advanced” tab.
    Click-environment-variable-button-270820
  4. You can either create a User Variable or a System Variable.
    • User variable: available to only that specific user.
    • System variable: available to all users including the system programs.

    Windows-10-environment-variables-270820

  5. To create a user variable, click “New” under the “User Variables” section.
  6. To create a system variable, click “New” under the “System Variables” section.
  7. Now, type the variable name in the first field. Make sure the name has no spaces or special characters.
  8. Next, type the variable value in the second field. For example, to open a folder, you have to enter its path in the Value field.
  9. Click “Ok” to add the environment variable.
    Add-environment-variable-windows-10-270820
  10. Click “Ok” in the environment variables window.
    Environment-variable-added-270820
  11. In the main window, click “Apply” and “Ok” buttons.
  12. Restart Windows 10 to apply the new environment variable.

That is all. From now on, you can use the custom variable from the Command Prompt window or Run window. To use the environment variable, add “%” to the start and end of the variable name. For example, if I want to open the downloads folder, I need to execute the “%downloads%” command. If you don’t add the “%” sign, Windows won’t recognize the variable value.

Execute-custom-environment-variable-270820

Important Note: If you want the operating system or the command line to access an executable then you need to add it as a value to the PATH variable. For example, to access Python from the Windows command line, you need to add Python executable to the PATH variable. Creating a new custom variable will not work.

That is all. I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible.

Leave a Comment

Scroll to Top