How To Create Custom Environment Variables in Windows 10

Environmental Variables are dynamic objects which define different elements in a Windows environment. These variables can be used by different programs from anywhere within Windows and provide certain parameters to perform specific tasks.

Creating custom environment variables in Windows assists you in the longer run, as it enables you to run a program or a .exe file from any directory in Windows, and the title of the program would still be recognizable.

If you are using the same path or directory over and over again, it would be better to create a variable and provide a path of your directory and just use that variable instead of having to give complete paths each time.

You can say these variables as shortcuts to your apps. This can make you move around in Windows rather quickly. Before we dig into the process of creating a custom environmental variable, let us briefly discuss a bit about them.

Types of Variables

There are two types of environment variables: A system variable and a user variable. Both are combined to make a complete computer environment.

System Variables

System variables are termed global variables and can be accessed or used by any user account on your computer.

User Variables

User variables are termed specific variables, which can only be accessed within the same user account. Other accounts on your computer are not familiar with such variables.

Use of Environment Variables

If you have to go to User Profile, and you have created a system variable with the name “userprofile”. You don’t need to open File Explorer and then navigate to your profile. Just simply access the variable you have created by typing “%userprofile%” into the Start Menu.

How To Create Custom Environment Variables in Windows 10 1
Access variable directly from anywhere

Accessing the variable, in this specific example, will automatically open your current user account.

How To Create Custom Environment Variables in Windows 10 2
Quickly access via environmental variable

Another example of using an environmental variable is while using a .exe file in the Command Prompt. If you have placed a .exe file in the “Downloads” folder, then you will need to provide the path “%userprofile%\Downloads\ABC.exe” each time to use the file. However, if it is declared as a user or system variable, then simply putting in “ABC.exe” will automatically fetch the .exe file, regardless of your current directory in the Command Prompt.

Now you know how these variables are helpful. Let us now show you how you can create your own custom variables and assign a path to save your time and navigate quickly within your OS.

Creating User Defined Environment Variables

Let’s create our own environment variables. Follow the steps below to do so:

  1. Type in sysdm.cpl in Run to open System Properties.
    sysdm
  2. From the System Properties window, switch to the Advanced tab and then click Environmental Variables.
    advanced
  3. From the Environmental Variables window, click New under User or System variables (Your choice).
    New
  4. In the New Variable popup, enter a name for your variable and then enter its complete path in Variable Value. Click Ok when done. In our case, we want to access the “Company” folder so we put the address of that particular folder in “Variable Value” of the new variable.
    ok

A new variable is now added to your environmental variables list.

New variable added
New variable added

Now typing in the name of your environmental variable in Run or Command Prompt will automatically open the desired location.

You can also create environmental variables for .exe files, batch files, etc., and use them to pass parameters and perform certain tasks.

If you wish to know the path for a variable, open the Command Prompt and type “echo” followed by the environmental variable inside percentage (%) signs, as in the following example:

cmd 5
Complete path to environmental variable

In case you do not wish to use a variable in the future or want to edit it, you can delete the variable by selecting it in the Environmental variables window and then clicking Delete, or you may also click Edit to change its path or name.

Closing Words

Creating your own customized variables can be super helpful in cases where you have to use a path over and over again. What methods do you use as shortcuts for opening your favorite programs and folders?

Also see:

Leave a Reply

You have to agree to the comment policy.