environment-variables-feature-image

What Are Environment Variables

Environment Variables

Since its inception Windows has used environment variables. In fact, all modern operating systems use environment variables in one way or another. These variables are used by Windows and programs you have installed to basically know where everything is, and where to put processed data.

In this article, we will be talking about environment variables, what they are, and I’ll also show you a practical example of how to use them.  This article will not go into the sophisticated depths of this subject, but it should give you a basic idea of how things work.

Two Types of Variables

There are two types of environment variables:

  • User variables – These variables are specific to each user on your computer. They can be set by Windows, programs, and by the user himself. Each user can change these values for his account only, and not other accounts on the machine. One example would be the location of a specific User Profile Directory on the computer.
  • System variables – These variables are global, meaning they are used by any and all users on your computer. These variables are set by Windows, programs, and drivers. One example would be %windir%, which simply shows where the Windows Directory resides. Another example would be %ProgramFiles%, which points to the location of the Program Files directory.

If this all sounds complicated, it really is not– it will all become clear to you as you read further in this article.

How To Access These Variables

Note: The following steps will be demonstrated using Windows 10. The screen shots may differ if you are using an older version of Windows, but the end result will be the same.

To gain access to the environment variables, follow these simple steps:

  1. Type WinKey + R to open the Run Box
  2. Type control panel and click OK

In the above image you will notice that Small icons is chosen.

3. Click System

4. Click Advanced system settings

5. Choose the Advanced tab at the top, then click the Environment Variables button

This is where the magic happens. You can see the window is divided into two groups: the upper panel contains User Variables and the lower panel contains the System variables.

Note: Tampering with System Variables can muck things up if you’re not careful so, for practice,  we’ll be focusing on the User variables today.

I have indicated a variable called TEMP (and its outdated cohort, TMP). Normally, this TEMP folder is located on the system drive by default, so it would look like this: C:\TEMP

Note: Don’t quote me on this, but I believe the archaic TMP variable remains for backwards compatibility with older programs.

Changing Environment Variables

In the above image, you will notice some of the aforementioned variables. In the System variables panel, you can see windir which points to the Windows directory on the C: drive. In the User variables panel, you can see a variable named OneDrive, which points to the location of my OneDrive folder on drive D:. There is also a Path variable which points to the location of my User profile on the C: drive.

You cannot change these Path variables and expect things to move. In fact, if you make a mistake in a Path variable, things will most likely break. Unless you are confident in your knowledge of how paths work, I would recommend leaving them alone until you can learn more.

Changing the TEMP variable, however, isn’t going to be much of a problem. If you make a mistake here, and Windows can’t find the location, it will revert back to the defaults.

To change the value of TEMP, highlight it, then click the Edit button. Change the value to point to a new location, then click OK. Do the same for the TMP variable so they match.

  • Note #1: You must create the Temp folder at the new destination before making this change if you want any hope of this working. Otherwise, you will be pointing to a place the doesn’t exist.
  • Note #2: You do not have to change the System variables if you don’t want to. This is strictly up to you.
  • Note #3: You will have to reboot your computer for these changes to take effect.

Why Change the Default Temp Folder Location?

Speed

One very good reason would be speed. In the above image you will notice that I have the TEMP variable pointing to a Temp folder on the R: drive. On my system, the R: drive is a 2GB RAMDrive I have installed. If you would like to learn more about RAMDrives, then please read RAMDrive: Increase Computer Speed by up to 50%

As fast as a Solid State Drive (SSD) may be, it doesn’t hold a candle against the speeds of internal memory. And if you’re using a mechanical hard drive (aka, “spinner”), then the benefits of setting up a RAMDrive can be truly incredible. The only limiting factor would be how much RAM you have installed.

Limiting SSD Writes

Windows and programs can sometimes make thousands of writes per minute to the Temp folder. Although this has become less of an issue with more modern SSDs, you may be comforted by the idea that fewer “writes” means longer SSD life. This would be another reason to move the Temp folder off your precious SSD to another drive.

The above image compares a reasonably fast SSD against some relatively slow RAM. Even with outdated RAM, the difference is vast.

Conclusions

Having control over environment variables can offer tremendous power to those who understand them. Even a simple change, as in the above example, can reap demonstrable benefits.

The preceding article barely touches upon the scope of what can be accomplished, but I hope it has given you a glimpse into  the possibilities, and hopefully provoked new bits of imagination to emerge.

Richard

2 thoughts on “What Are Environment Variables”

  1. Very good reading Richard!! I have never missed with the PC setting their, really did not even know what what the Environment Variables button was for?

Comments are closed.

Exit mobile version