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

Ads by Google

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?

Ads by Google

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!

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Windows Troubleshooting
Windows Troubleshooting
10 Members
Windows_10
Windows_10
8 Members
Windows Hacks & Customization
Windows Hacks & Customization
21 Members
Best Windows Software
Best Windows Software
13 Members
Ads by Google
Comments (12)
  • SaapeXD MoHods

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

  • Paul Girardin

    Thanks for sharing!

  • Catherine McCrum

    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?

  • Márcio Guerra

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

    Cheers!

  • Dmitry

    Also don’t miss free environment editor: http://eveditor.com

Load 10 more
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
Affiliate Disclamer

This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.