By default, Windows uses specific environment variables so that users can quickly access specific paths and directories in the operating system. This helps make navigating Windows easier. By defining and setting your own environment variables, you can create direct paths and shortcuts to applications, directories, URLs, and more.
Environment variables on Windows are queued with percent characters (%). So, if you haven’t used environment variables before, you can get started by simply launching the Start menu, typing any of the following commands in the search box and pressing Enter.
% appdata %% temp %% userprofile%% homepath%
Notice how if you simply typed the term appdata into the search box, it would return many different results. However, if you enter the term% appdata% in the search box, you will call the environment variable and be taken to the AppData Roaming directory.
Now that you are a little used to using environment variables, let’s get down to how to add, edit, or remove environment variables. Click the Start button and enter environment variable in the search box. Click Change System Environment Variables.
– /
The System Properties dialog box opens on the Advanced tab. Click the Environment Variables button at the bottom.
This will bring up the Environment Variables dialog, as shown below on Windows 10. On Windows 7, it looks a little different, but works the same. The dialog is divided into two parts: the upper one for user variables and the lower one for system variables.
Now let’s add a very simple environment variable to Windows 10. Click the New button under the Custom Variables section. The “New User Variable” window opens, where you can define the variable name and variable value.
In the Variable Name: text area, you can specify a simple name for the environment variable. In the “Variable value:” text area, you can define a path or other value that is triggered when using a variable name. So let’s create a very simple environment variable to run the Help Desk Geek website. Here are the meanings:
Click OK to add the custom variable and click OK in the Environment Variables window to close and apply the variable.
After that, you can test the variable in several ways. First, if you want to be able to launch it from the Start menu, you will need to restart your computer. For some reason, if you don’t restart it, it can only be invoked using Explorer or the Run command.
Explorer:
Explorer:
Run command (Windows key + R)
Run command (Windows key + R)
Start Menu Search Box
Start the search box in the menu
Using any of the three methods above, Windows will launch your default browser and open a tab on the Help Desk Geek website. Pretty cool, right? You can also create a custom environment variable to launch Explorer to a specific directory.
This can be useful if you often find yourself navigating to a directory deep in the file hierarchy. For example, here’s the directory I refer to a lot:
C: Users aseem Documents HOA Stuff Legal Contracts Appeals Notes
Instead of going through all of these directories, I can simply create a new user environment variable like below:
Now, in explorer, all I have to do is enter% HOA% in the address bar, and it will take me straight to that directory! You can also click the Browse Directory or Browse File button to make it easier to include the path to the desired folder or file.
The interesting thing about the file option is that it means you can also create an environment variable to run the program. For example, you can point an environment variable to any EXE on your system. When you call a variable, it runs the program.
The above example is a bad example because it is easier to hit Start and type cal than it is to type% CAL%. However, if you have a custom program executable stored in some random directory on your PC, this is an easy way to run it without looking for it. Enjoy!
–