How to Create Custom Environmental Variables in Windows 11

In this guide, we will show you the steps to create custom environmental variables on your Windows 11 PC. But why would one want to carry out this task? Well, creating these variables is like creating a shortcut that would allow you to directly indicate a location with just a single keyword rather than typing in the entire location all the time. Let’s try and understand it with the help of an example.

Suppose you wish to access the TEMP folder on your PC. Then the general approach is to use its complete directory, which is: C:\Users\UserName\AppData\Local\Temp. However, manually typing in the above location would call for a lot of effort. Well, even remembering this location is no easy task in itself. This is where the Environment Variables come in handy.

How to Create Custom Environmental Variables in Windows 11

As far as the aforementioned location is concerned, Windows has assigned the TEMP or TMP keyword to it. So rather than typing in that lengthy location every time, you could simply make use of its associated variable. Along the same lines, Windows has also assigned the USERPROFILE variable to C:\Users\UserName\.

So instead of the complete address, you could just use the said keyword to go to that directory. Well, these were some of the variables that have been already created by Windows. Turns out, you could also create custom environmental variables for your preferred locations on your Windows 11 PC. And in this guide, we will show you how to do just that. So without further ado, let’s get started.

How to Create and Use Custom Environmental Variables in Windows 11

How to Create Custom Environmental Variables in Windows 11

Before starting off with the steps, there’s an important point worth discussing. There exist two different types of variables: System and User Variables. The difference between the two? A System Variable is a global variable that could be accessed by every user that is using that system.

On the other hand, a User Variable is directed towards a specific user only, so the user who is currently logged in to your system could access that variable. Now that’s understood, let’s check out the steps to create custom environmental variables on your Windows 11 PC. Follow along.

How to Create a New Environmental Variable in Windows 11

  1. Use the Windows+I shortcut keys to bring up the Settings menu.
  2. You should be taken to the System page. Scroll to the end of it and click on About.
    How to Create Custom Environmental Variables in Windows 11
  3. Then go to the Device Specification section and click on Advanced System Settings.
    How to Create Custom Environmental Variables in Windows 11
  4. It shall open the System Properties dialog box, click on the Environmental Variables button.
    How to Create Custom Environmental Variables in Windows 11
  5. Now decide if you want to create a System or User environmental variable on your Windows 11 PC.
  6. Whatever you have decided upon, click on the New button situated next to that section (as for this guide, I am going ahead with the User Variable).
    How to Create Custom Environmental Variables in Windows 11
  7. Under the Variable Name section, assign it any name of your choice keep it such that it is easily able to identify its associated directory. However, make sure not to have any space in the name. For this guide, let’s keep the variable name ChromeLatest.
  8. Once the naming is done, assign it the desired location under the Variable Value section. For that, you may use the Browse Directory or Browse File button.
    How to Create Custom Environmental Variables in Windows 11
  9. Or, you may also copy the location from the File Explorer. For this guide, the value (location) is: C:\Users\Syed Sadique Hassan\AppData\Local\Google\Chrome\Application\92.0.4515.131.
  10. Anyways, once both the values have been entered, click OK. You should now see the Variable and its associated Value entered under your chosen section (User or System Variable).
    How to Create Custom Environmental Variables in Windows 11

So with this, you have successfully created the custom environmental variables on your Windows 11 PC. Let’s now check out how to use it.

How to Use the Newly Created Environmental Variable in Windows 11

You could access your created environmental variables from various places, but let’s discuss the three most important and frequent cases:

From Command Prompt

  1. Head over to the Start menu, type in CMD, and launch Command Prompt as an admin (recommended).
  2. Now type in the below command, replacing the ‘variable’ keyword according to the name of your environmental variable:
    echo %variable%

    How to Create Custom Environmental Variables in Windows 11

  3. In my case, the above command will transform to:
    echo %ChromeLatest%

Via PowerShell Window

  1. Head over to the Start menu, type in PowerShell, and launch the PowerShell window as an admin (recommended).
  2. Then type in the below command, replacing the ‘variable’ keyword according to the name of your environmental variable:
    Write-Output $env:variable

    How to Create Custom Environmental Variables in Windows 11

  3. So in my case, the above command will transform to:
    Write-Output $env:ChromeLatest

From Start Menu

  1. Open the Start menu and type in the below command. Make sure to replace the ‘variable’ keyword with the name of your environmental variable:
    %variable%
  2. As an example, in my case, the above command will transform to:
    %ChromeLatest%

That’s it. These were the steps to create and use new custom environmental variables on your Windows 11 PC. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.

Can I Add Two or More Values under the Same Environmental Variable?

So some of you might ask that whether it is possible to create two or more values (locations) and add them under the same variable? Well, the answer is YES, it is definitely possible. You could check the same right away. Just select the Path System variable on your PC and hit the Edit button- there would already be a plethora of directories within it (and you could also populate it with more of your choices via the New button).

How to Create Custom Environmental Variables in Windows 11

The one at the top of the list will be given the maximum weightage by Windows, so make sure you have your list sorted  (or use the Move Up and Move Down keys for the same). As a personal recommendation, I would suggest not to add your own directories to the already created variables, unless the software specifically asks for the same. Rather consider creating your own and then you may add as many as you want inside that if the need arises.


Share: