Environment variable

An environment variable is a dynamic "object" on a computer that stores a value, which in turn can be referenced by one or more software programs in Windows. Environment variables help programs know what directory to install files in, where to store temporary files, where to find user profile settings, and other things. It can be said that environment variables help to create and shape the environment of where a program runs.

Environment variables are dynamic because they can change. The values they store can be changed to match the current computer system's setup and design (environment). They can also differ between computer systems because each computer can have a different setup and design (environment).

There are a number of environment variables that get referenced by programs and can come in handy for a computer user to find needed information about their computer environment. The more common and important ones to be aware of are shown below.

%appdata%
%commonprogramfiles%
%local%
%localappdata%
%programfiles%
%temp%
%userprofile%
%windir%

Tip: You can access any of the above folders by entering the environment variable in the Windows Run box or Windows Search Box. For example, to get into the Application Data folder type %appdata% and then press Enter in the Run box.

%appdata%

The %appdata% environment variable contains the directory path to the Application Data folder for your user profile. This folder stores settings and logs, among other things, for various software programs. The settings and logs stored there are specific to your user profile.

%commonprogramfiles%

The %commonprogramfiles% environment variable contains the directory path to the Common Files folder, within the main Program Files folder. This folder contains various files for common programs and utilities on a computer, mostly system and services related. The default directory path this variable points to is c:\Program Files\Common Files.

%local%

The %local% environment variable points to where the security policies & rules are located for the user's account, Windows in general, Windows Firewall, Network, and various software programs on the computer. This environment variable is native to Windows 7.

%localappdata%

The %localappdata% environment variable contains the directory path to where programs store their temporary files. Common temporary files to be stored here are Desktop Themes, Windows Error Reporting, program caching and Internet browser profiles. This environment variable is native to Windows Vista & Windows 7.

%programfiles%

The %programfiles% environment variable contains the directory path to where programs are installed. This directory contains sub-directories for each program, which contain the primary files needed by each program in order to run on a computer. The default directory path this variable points to is c:\Program Files.

%temp%

The %temp% environment variable contains the directory path to where temporary files will be stored. These temp files are often Internet temporary files and other user application temporary files (Microsoft Word, Excel, Outlook, etc.). The files located in this directory can be deleted periodically to help improve computer performance.

%userprofile%

The %userprofile% environment variable points to the current logged in user's profile and the directory where user profile data is stored. It is in this directory that a user can find the following folders: My Documents, My Music, My Pictures, Desktop, and Favorites (Internet Explorer bookmarks).

%windir%

The %windir% environment variable points to the Windows directory, where Windows system files are located. This directory is where Windows will installs. The default directory path for most versions of Windows is c:\Windows (for Windows NT 4 and 2000, it is c:\WinNT).

Related pages

Also see: Environment, Percent, Variable