Skip to content

Thursday, November 12th, 2009

Environment Variables

February 18, 2009 by Sravan  
Filed under Computers

Environment variables are a set of dynamic variables that can determine the environment in which a process runs. While they are more easily visible and often used in Unix-based OSs, they are equally essential on Windows. A little knowledge is especially important to write batch programs (.BAT).

The command env typed in your command prompt or Cygwin terminal will list the entire set of environment variables and their current values. My Computer –> Properties –> Advanced –> Environment Variables will also show you the Windows environment variables divided into two categories: System variables and User variables.

Environment Variables

While on cmd each variable can be referred to using %ENVIRONMENT-VARIABLE%, on Cygwin and all Unix-based OSs they are referred to using $ENVIRONMENT-VARIABLE. ($ echo %ENVIRONMENT-VARIABLE% or $ echo $ENVIRONMENT-VARIABLE)

ALLUSERSPROFILE, APPDATA, COMPUTERNAME, HOMEDRIVE, HOMEPATH, PATH, PROGRAMFILES, SYSTEMDRIVE, SystemRoot, USERNAME, USERPROFILE, WINDOWS are a some important environment variables some of which may be modified and are usually quite useful while writing batch programs. OS, NUMBER_OF_PROCESSORS, PROCESSOR_ARCHITECTURE, PROCESSOR_IDENTIFIER, PROCESSOR_LEVEL are a few other interesting variables which are best left untouched.

$ set ENVIRONMENT-VARIABLE=value can be used to change an existing or define a new environment variable.

Image Source: Microsoft Windows on my desktop.

  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Reddit
  • Yahoo! Buzz
  • Slashdot
  • E-mail this story to a friend!
  • BallHype
  • YardBarker

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


About Us | Advertise with us | Blog for EveryJoe | Privacy Policy | Terms of Use
Get This Theme | Sitemap


All content is Copyright © 2005-2009 b5media. All rights reserved.