Google

» Using Environment Variables When Creating Shortcuts To Folder Locations In Windows

As any good programmer or developer knows, writing code that references environment variables instead of hard coding paths will always keep them out of trouble. For the average home Computer user, using variables to reference applications and program executables or folders locations when creating shortcuts, writing scripts and in batch files is also a good idea.

But for many home Window users, variables may be something of an unknown, let alone where to find them, how to use them and how to create new variables.

So What Are Environment Variables?

Environment variables are specially named aliases that are placeholders for certain basic system properties. Environment variables are strings that contain information such as drive, path, or file name, which control the behavior of various programs.

How Do I See Environment Variables?

The easiest method is to click on Start \ Run, type sysdm.cpl and click OK.

In the System Properties dialog box, click the Advanced tab, then click on the Environment Variables button at the bottom.

envvariables1.png

Two types of variables exists, User, which is for the current account that is logged on and System. As you might expect, any variables listed for the User, can only be used by that account, while System is global and available to everyone.

In reality, there are more variables not shown above. To see them all, open a command prompt and type the command set.

Yea, But How Do They Work?

In the System variable section, scroll down to the temp variable. You will notice the value equals C:\Windows\TEMP. If you were creating a batch file and wanted to reference the path to the TEMP directory, instead of typing the full path, you can reference it as %TEMP%.

Now later, say you needed to move the location of the TEMP directory. You can then just change the value to the new path of the TEMP variable, and not worry about needing to find all the batch files if you had hard coded the path.

You are not limited to using the variables that currently exists. You can easily create new variables by clicking on the New button in the Environment variables dialog box (screen shot above).

envvariables2.png

In the example above, I created a variable called MP3 with the value of c:\mymusic\mp3. Now, when I create a shortcut to the mp3 folder, I would enter the path as just %MP3%. Later, I can move the mp3 folder anywhere and just change the value if the MP3 variable instead of needing to modify the shortcut.

You can also nest variables. If I decided to move the mp3 folder to the Temp folder (which is not a good idea, but will just be used as an example) and I created a shortcut, I would enter the path as %TEMP%\%MP3%.

Some of the more popular variables are:

SYSTEMROOT
USERNAME
USERPROFILE

TIME
DATE
COMPUTERNAME

Now that you understand variables and how to create them, their uses are endless. Variables allows you to make changes on your Computer and modify the change in one location instead of needing to hunt down a bunch of shortcuts or batch files.

| 925 Sterling Silver Jewellerys | Video On Demand | ATV-Sport | Baby Monitor | Basket Ball Shoes | Lady Fashion Shoes | Bedroom Sets | Best LCD TV Brand | Best Wireless Bluetooth Headset | Body Massager | Brand Sport Shoes | Brands Handbag | Car Monitor | Car MP3 Player | CCTV Camera | CCTV Systems | CDMA Cell Phones | Cheap Mountain Bikes | Cheap Road Bikes | Computer Monitor | Costume Jewellery | Dressing Shoes | Fashion Jewellery | Fashion Handbags | Fashion T-shirts | Fashionable Sports Shoes | Fashion Handbags | Fashion Shoes | Fire Extinguisher | Fishing Boats | Flash Memory Cards | Flash USB Disk | Gas BBQ | Gas Grill | Gold Jewellery | GSM Cell Phones | Home DVD Player | Ice Breakers | Integrated Kitchen Cabinets | Kids Children Furniture | Lady T-Shirt | LCD TV With DVD Combo | LCD TV With DVD Player | LCD Monitor | LED Lights | Memorial Cards | Mibo Shade | Mini Bluetooth Headset | Mini Digital Camera | Mini DVD Player | Mobile Phone Bluetooth Headset | Modern Leather Sofas | MP3 Necklace | Nokia Cell Phones | Notebook Keyboard | Outdoor Patio Furniture | Pave Diamond Wedding Bands | PC Video Cards | PC Webcam | Plywood | Polyester Fabric | Popular Shoes | Prenatal Vitamins | Safety Shoes | Sata Hard Drive | Sata Harddrive | Seas Pearl Necklace | Security Cameras | Server Hard Drive | Skin Care Products | Skin Moisturizer | Skin Oil Control | Slim Digital Camera | Slim Keyboard | Slimming Diet Pills | Small Electric Skillet | Solar Lights | Sportbasketball Shoes | Sterling Silver Jewellery | TFT LCD Display | TFT LCD Monitor | TFT LCD TV | Tiffany Lamps | USB Card Reader | USB Disk | USB DVD Player | USB External Harddrive | USB Webcam | Window Blinds | Wireless Baby Monitor | Wireless Keyboard | Wireless Multimedia Keyboard | Women Beautiful Shoes | Discounttire | Sexual Toys | iPhone 3G Accessories | Whirlpool Bathtubs | Toilets | Americanracing | Christringminist | HTC Max 4g | Car Electronics | Satellite Television | HP Laptops | HP United States | Discount Computer Software | Borders Books | Acer United States | Video Game Players | Buy Cheap Apple iPods | Magazines USA | USA Electronics | Video VHS Used Videos | Kitchen H ousewares Small Appliances Cookware | Furniture Decor Dining Bedroom Patio | Bed Bath Bedding Bathroom Accessories | Home Appliances Air Conditioners Sewing Machines | Housewares Kitchens | Home Improvement Garden Tools Lawn Hardware | Outdoor Living Grills Patio Furniture | Pet Supplies Birds Sats Dogs | Sewing Craft Hobby | Grocery Breakfast Foods Snacks Organic | Natural Organic Grocery | Gourmet Food Gifts Chocolate Seafood | Health Personal Care Nutrition Fitness | Beauty Makeup Fragrance Skin Care | Jewelry Watches Engagements Rings Diamonds | Tools Power Cordless Saws Drills | Lawn Garden Tools Hardware | Automotive Auto Truck Replacements Parts | Powersports Automotive | Industrial Scientific Fastners Raw Materials | Watches Mens Womens Children Accessories | Shoes Men Women Kids Baby | Apparel Accessories Men Women | Office Products Supplies Electronics Furniture | Musical Instruments Accessories Sound Recording | Toys Games Electronics Action Figures | Computer Video Games Hardware Accessories | Baby Car Seats Strollers Bedding | PC Components Computer Add Ons Computers | Software Business Education Finance Childrens | DVD Used HD Action Comedy Oscar | MP3 Music Download | Music Rock Classical Pop Jazz | Canon United States | Computer Tips Online |