What Are Environment Variables & How Can I Use Them? [Windows]

Craig Snyder 05-02-2013

environmental variables windowsEvery now and then I’ll learn a little tip that makes me think “well, if I known that a year ago then it’d have saved me hours of time“. I vividly remember learning how to use the copy and paste functions, all on my own, as a kid. It was like the entire Internet had just become twice as easy for me.


Environment variables are a little-known detail of Windows, if you’re a novice user. They belong in this same realm of time-saving conversation. Once you learn about and begin making use of your environment variables, you will quickly begin to see just how much time and effort you can save.

What Is An Environment Variable?

An environment variable is actually very simple. They act as dynamically-named values that pertain to certain elements of Windows and its file system.

As an example, %SystemDrive% is a default system path variable that works with every version of Windows. To you and I, this probably translates to just C:. However, there are people out there who decide it’s necessary to rename their system drive. Someone may decided to set it as drive letter D or E. In those cases, %SystemDrive% would return those values.

environmental variables windows

As another example, there are then discreet value variables such as %TIME% and %DATE%. I’ll bet you can guess what values they hold.


Why Are Environment Variables Important?

Through each version of Windows, things change. For example, in Windows XP your application data was stored at the path C:\Documents and Settings\{username}\Application Data. Post-Vista, it is now C:\Users\{username}\AppData\Roaming. So how do applications know where to store your data? Must they first determine what OS you’re on, ignoring the possibility for later changes and Windows updates, and hardcode where to save?

No. They use the %APPDATA% environment variable, which returns the values of those paths dynamically.

how to use environment variables

Think of environment variables as a way of future-proofing your system and protecting it from issues that hardcoded values could cause to be catastrophic.


How Can Environment Variables Be Useful For Me?

Of all environment variables available, system path variables can be the most useful to you and I. Below is a screenshot taken directly from the Wikipedia page on this subject.

how to use environment variables

The Windows Vista/7 column has been left out so that the screenshot is easier to read. You can copy and paste any of these environment variables directly into Windows Explorer as a shortcut to navigating directly to that location without keying out the full path.

environmental variables windows


This creates a huge possibility for text-based shortcuts to some of the most important folders. You can even use environment variables in your own applications that save data to your computer (if the field allows you). Be advised that, if copy and pasting the variables, you need to make sure there is no space before or after.

A lot of you have probably used an environment variable without really noticing, probably to access your application data. It’s good to memorize some of these variables, as they can really help you navigate through your files. The saved time adds up. Trust me.

What do you guys think of this tip? Is it something you knew about or a feature that you’ve always overlooked? Let us know in the comments!

Whatsapp Pinterest

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Sheetal_D
    November 20, 2015 at 11:22 am

    After a lot of wandering on the internet, I finally managed to find the real use of these. Clean and simple. Thanks for solving the confusion.

  2. SaapeXD MoHods
    March 6, 2013 at 7:01 am

    I use environment variables quite often! But never fully understood them! Thanks! :D

  3. Paul Girardin
    February 9, 2013 at 7:01 am

    Thanks for sharing!

  4. Catherine McCrum
    February 8, 2013 at 4:29 am

    Several years ago I changed variables for date & time to ensure my system would not be triggered by a specific date targeted virus. I simply jumped my date on the system well past the date trigger for the michelangelo virus (yes that was many years ago - in the late 80's I think). I had suggested this preventative fix to several IT friends of mine and basically just got laughed at. Well, as it turns out, they got a lot of overtime pay fixing a lot of computers that did get nailed with that virus.

    Anyway, a cheat sheet for the variables, similar to what you have shown us above, would have been quite a time saver as I remember spending hours and hours figuring out how I was going to protect my wee little computer. And this was on DOS I think. Can you tell I am not a programmer?

  5. Márcio Guerra
    February 8, 2013 at 3:50 am

    Nice article... Need to take a better look at this if I go back to Windows...


  6. Dmitry
    February 6, 2013 at 8:55 pm

    Also don't miss free environment editor:

  7. Mohammad Wasiullah
    February 6, 2013 at 5:45 am

    I think some temp cleaner could be helpful for free up space i our system

  8. Paul-G
    February 5, 2013 at 11:36 am

    That was nicely laid out with paragraphs to make it easily readable - what happened?

  9. Paul-G
    February 5, 2013 at 11:35 am

    How To - move your temporary files to an easy to find place.

    Why does Microsoft hide them in such hard to find places where the content builds up and slowly eats into disk space?

    To change a value in Win7 (CAUTION - you may break your system if you do not fully know what you are doing!)

    In Windows Explorer left hand pane, Right click on My Computer then select Properties to activate a pop-up window 'Control Panel\All Control Panel Items\System'

    In the left hand pane, select Advanced Properties.

    The System Properties pop-up will appear with the Advanced tab selected. At the bottom is a button labelled Environment Variables.

    If you click on the button, yet another pop-up appears where you can edit the environment variable values.

    Before doing the following, run CCleaner or other system clean-up.

    My personal reason for doing this is to move all of the temporary file containers to one place. I create a Temp-Win folder at the root of a drive (usually D:\Temp-Win) and change the values of both the User and System TEMP & TMP variables. Once done, all temp files will be in an easily accessible place for easy monitoring/cleanup.

    Additionally, move Internet Explorers 'Temporary Internet Files' container and FireFox Cache to the new folder. Google for instructions.

    • Nevzat Akkaya
      February 5, 2013 at 3:00 pm

      The reason Microsoft hides them and keeps them separated is Temp folders may contain sensitive information, so they must be located under user specific folders and accessible to only that user. "Temporary Internet Files" and TEMP folders are sensitive and need to be protected.

  10. Switchblade Rebirth
    February 5, 2013 at 11:11 am

    Here's a geeky tip: You can create custom variables such as "Chrome", "Firefox", "WinStore", etc.

    For Windows 8 users here's how you can access windows store using environment variables and run dialog.

    Right Click Computer, click on properties, advanced, environment variables. Now here it's up to you if it's system or user variable but I chose the latter.

    Click new, Variable name should be "WinStore" without quotes, and value should be "ms-windows-store:" without quotes.

    Try typing %WinStore%, and it will launch the windows store.

    Craig if you are reading this, note environment variables can be used to open apps without the need of Win + R Alias manager, as long as you the value is the path of the executable. :)

  11. Nevzat Akkaya
    February 5, 2013 at 6:34 am

    This freeware utility eases the management : "Rapid Environment Editor" :

  12. Bobby Dunn
    February 5, 2013 at 5:05 am

    Any tips for heavy users on what variables to add to the default windows enviroment you find in the system settings?