Yesterday, we learned about Environmental Variables. Today I’ll show you how to create your own and edit the ones that ship with Windows!

Why Should I Make My Own?

Creating your own Environmental Variables can be very useful! Let’s say you want a quick and easy way to access the same folder repeatedly, we’ll use the example of a backup drive: We can create a variable to point to a specific folder. We’ll use this example: You have a second hard drive in your machine, this drive’s sole purpose is to store backups for all users on your computer. The path to your documents in the backup folder on this drive is:

n:\backup\users\john\documents

This address is not very long, but it can be a pain when you have to type or navigate to it repeatedly - and we’re geeks, we like the quickest, easiest way to do everything! Wouldn’t it be easier to just type:

%backupdocs%

Of course it would! Start off by hitting the Windows Key+R and typing this command:

sysdm.cpl

You can also reach this location by navigating to Control Panel->Performance and Maintenance->System or right-click on My Computer and choose “Properties” - but remember: Geeks=Fast (just don’t tell my wife :razz: ). Click the Advanced tab, then click the “Environmental Variables” button.

The System Properties Dialog

In the Environmental Variables dialog, under “User Variables for <User Name>”, click the “New” button.

The Environment Variables Dialog

Type the variable name (what you’ll type when you want to call the variable) and the value (what the variable points to).

Creating A New User Variable

Click the “OK” button in all dialogs. Changes should be immediate!

Vista Only Tip Permanently Change A Variable Via The Command Prompt

Vista

Using the set command from the command prompt (read: in a batch file), you can make permanent changes to environment variables. Example: to change to location of the %backupdocs% variable to G:\john, the command would be:

setx path "%backupdocs%;G:\john"

:!: Again, this permanently changes the location of the variable, so be careful! :!:

Edit: XP

Apparently you can use the set command with a command-line tool called setx.exe which is included in the Windows XP Service Pack 2 Support Tools. I haven’t tested this so your mileage may vary!