Create Custom Environment Variables in Windows
Any easy way to launch apps without looking for them
By default, Windows uses certain environment variables to allow users to quickly access certain paths and directories within the operating system. This helps to make Windows easier to navigate. By defining and setting up your own custom environment variables, you can create direct paths and shortcuts to apps, directories, URLs and more.
Environment variables in Windows are queued by percent (%) characters. So, if you’ve not used environment variables before, you can get started simply by launching the start menu and typing any of the following commands into the search box and pressing Enter.
Notice how if you were to simply type the termappdatainto the search box, it would return a wide variety of different results. However, if you type the term%appdata%into the search box, you are invoking an environment variable and you are taken to theAppData Roamingdirectory.
Now that you’re slightly accustomed to using environment variables, let’s get started on how you add, edit or delete environment variables. Click on the Start button and type inenvironment variableinto the search box. Click onEdit the system environment variables.
This will open up theSystem Propertiesdialog to theAdvancedtab. Click on theEnvironment Variablesbutton at the bottom.
This will bring up the Environment Variables dialog as shown below in Windows 10. It looks a bit different in Windows 7, but it works the same way. The dialog is split in two: the top for user variables and the bottom for system variables.
Now, let’s add a very simple environment variable to Windows 10. Click theNewbutton listed under theUser variablessection. This will present you with theNew User Variablewindow, where you can define avariable nameand avariable value.
TheVariable name:text area lets you define a simple name for the environment variable. TheVariable value:text area lets you define a path or other value that is triggered when the variable name is used. So, let’s create a very simple environment variable to launch the Help Desk Geek website. Here are the values:
Click theOKbutton to add your custom variable, and click theOKbutton on the Environment Variables window to close and apply the variable.
With that done, you can now test the variable in a couple of different ways. Firstly, if you want to be able to launch it from the Start menu, you’ll need to restart your computer. For some reason, unless you restart, it can only be invoked by using Explorer or by using theRuncommand.
Explorer:
Run Command (Windows key + R)
Start Menu Search Box
Using any of the three methods above, Windows will launch your default browser and open a tab to the Help Desk Geek website. Pretty cool right? You can also create a custom environment variable to launch Explorer into a specific directory.
This can come in handy if you often have to navigate to a directory that is deep in your file hierarchy. For example, here is a directory I have to access often:
Instead of having to click through all those directories, I can just create a new user environment variable like below:
Now, in Explorer, all I have to do is type%HOA%in the address bar and it will bring me right to that directory! You can also click on theBrowse DirectoryorBrowse Filebuttons to more easily include the path to your desired folder or file.
The file option is interesting because it means you can also create an environment variable to launch a program. For example, you can point an environment variable to any EXE file on your system. When you invoke the variable, it will launch the program.
The above example is a bad example because it’s easier to click on Start and type incalthan it is to type in %CAL%. However, if you have a custom executable program file stored in some random directory on your PC, this is an easy way to launch it without having to go look for it. Enjoy!
Founder of Help Desk Geek and managing editor. He began blogging in 2007 and quit his job in 2010 to blog full-time. He has over 15 years of industry experience in IT and holds several technical certifications.Read Aseem’s Full Bio
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved