Main Page

From Environment Variables
Jump to: navigation, search

Contents

Introduction

This website is a non-profit project and dedicated to all kind of environment variables, no matter whether they exist in Microsoft Windows, Unix, Linux or other operating systems. Environment variables declared and used in frameworks and programming languages like .NET, Java, Python, Ruby, etc. are also good candidates for the inclusion. The purpose of creators of the website is to build and maintain a full directory of environment variables from all over the software world. If you want to contribute to the project, please, drop a line to info@environmentvariables.org. Any kind of help is highly appreciated.

Environment variables

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. They can be said in some sense to create the operating environment in which a process runs. For example, an environment variable with a standard name can store the location that a particular computer system uses to store temporary files — this may vary from one computer system to another. A process which invokes the environment variable by (standard) name can be sure that it is storing temporary information in a directory that exists and is expected to have sufficient space.[1]

In almost all operating systems each process has its own private set of environment variables. By default, when a process is created it inherits a duplicate environment of its parent process, except for explicit changes made by the parent when it creates the child. Running programs can access the values of environment variables for configuration purposes. Examples of environment variables include:

  • Path - lists directories the shell searches, for the commands the user may type without having to provide the full path.
  • Temp - location where processes can store temporary files
  • UserProfile - indicate where a user's home directory is located in the file system.
  • AppData\{DeveloperName\AppName} - for storing application settings.
  • Temp - location where processes can store temporary files.[1]

System and local (user) environment variables

Environment of any process is defined by variables that determine the behavior of the process as well as the entire operating system. The behavior can be defined by using two types of environment variables, system and local. System environment variables define the behavior of the global operating system environment. Local environment variables define the behavior of the environment of a process.

System environment variables are preset in the operating system and available to all Windows processes. Only users with administrative privileges can change system variables. These variables are most commonly used in logon scripts, they are stored in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ registry hive.

Local environment variables are only available when the user for whom they were created is logged on to the computer. Local variables set in the HKEY_CURRENT_USER\Environment\ registry hive are valid only for the current user, but define the behavior of the global operating system environment.

Types of environment variables

The following list describes the various types of variables in descending order of precedence:

  1. System variables (built-in variables & ones from the HKEY_LOCAL_MACHINE hive)
  2. Local variables found in the HKEY_CURRENT_USER hive
  3. All environment variables and paths set in the Autoexec.bat file (if present)
  4. All environment variables and paths set in a logon script (if present)
  5. Variables used interactively in a script, batch file or application.[2]

Usage

The variables can be used both in scripts and on the command line. They are usually referenced by putting special symbols in front of or around the variable name. For instance, to display the program search path, in most scripting environments, the user has to type:

echo $PATH

On DOS or Windows system, the user has to type this:

echo %PATH%

References

  1. 1.0 1.1 Wikipedia
  2. Microsoft Windows XP Reference

List of Windows environment variables


See also

Personal tools
Namespaces

Variants
Actions
Navigation
Catalogue
Google AdSense
Tools