Pinterest Stumbleupon Whatsapp

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!

Leave a Reply

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