|
Environment variables are a set of dynamic values that can affect the way running processes will behave on a computer. In computer science, a value is a sequence of bits that is interpreted according to some data type. ...
In computing, a process is, roughly speaking, a task being run by a computer, often simultaneously with many other tasks. ...
Synopsis In all Unix and Unix-like 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 (more exactly, between fork and exec). All Unix operating system flavors as well as DOS and Microsoft Windows have environment variables; however, they do not all use the same variable names. Running programs can access the values of environment variables for configuration purposes. Examples of environment variables include Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®) is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ...
Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ...
In computer science and mathematics, a variable (IPA pronunciation: ) (sometimes called a pronumeral) is a symbolic representation denoting a quantity or expression. ...
Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®) is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ...
// An operating system (OS) is a set of computer programs that manage the hardware and software resources of a computer. ...
Instructions on how to use the directory command. ...
Microsoft Windows is the name of several families of proprietary software operating systems by Microsoft. ...
- The PATH which lists directories the shell searches, for the commands the user may type.
- HOME (Unix-like) and userprofile (Microsoft Windows) indicate where a user's home directory is located in the file system.
- TERM (Unix-like) specifies the type of computer terminal or terminal emulator being used (e.g., vt100 or dumb).
- CVS_RSH (Unix-like) is used to tell CVS which rsh-like program to use.
- MAIL (Unix-like) is used to indicate where a user's mail is to be found.
Shell scripts and batch files use environment variables to store temporary values for reference later in the script, and also to communicate data and preferences to child processes. Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ...
On Unix systems, a home directory (sometimes called a home folder) is a path on the local file system where a users personal files are stored. ...
It has been suggested that Crash counting be merged into this article or section. ...
Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ...
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system. ...
Apple Terminal. ...
The VT100 was a video terminal made by Digital Equipment Corporation (DEC) which became the de facto standard used by terminal emulators. ...
It has been suggested that this article or section be merged into Data terminal. ...
Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ...
The Concurrent Versions System (CVS), also known as the Concurrent Versioning System, is an open-source version control system invented and developed by Dick Grune in the 1980s. ...
rsh (remote shell) is a command line computer program which can execute shell commands as another user, and on another computer across a computer network. ...
Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ...
A shell script is a script written for the shell, or command line interpreter, of an operating system. ...
In Unix, an environment variable that is changed in a script or compiled program will only affect that process and possibly child processes. The parent process and any unrelated processes will not be affected. In DOS changing a variable's value (or removing it) inside a BATCH file will change the variable for the duration of command.com's existence. In Unix, the environment variables are normally initialized during system startup by the system init scripts, and hence inherited by all other processes in the system. Users can, and often do, augment them in the profile script for the shell they are using. In Microsoft Windows, environment variables defaults are stored in the windows registry or set in autoexec.bat. The Windows registry is a database which stores settings and options for the operating system for Microsoft Windows 32-bit versions, 64-bit versions and Windows Mobile. ...
Getting and setting environment variables 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 on a DOS or Windows system, the user could type in this command: A command line interface or CLI is a method of interacting with a computer by giving it lines of textual commands (that is, a sequence of characters) either from keyboard input or from a script. ...
echo %PATH% Other scripting and shell environments sometimes use other symbols for the same purpose, such as the commonly used dollar sign syntax used by many UNIX shells: echo $PATH DOS In DOS and Windows, the SET command without any arguments displays all environment variables along with their values. To set a variable to a particular value in DOS-WINDOWS, use: SET VARIABLE=value UNIX The env, set, and printenv commands display all environment variables and their values. env and set are also used to set environment variables and are often incorporated directly into the shell. printenv can also be used to print a single variable by giving that variable name as the sole argument to the command. env is a shell utility for Unix-like operating systems (including Linux). ...
env is a shell utility for Unix-like operating systems (including Linux). ...
In UNIX, the following commands can also be used, but are often dependent on a certain shell. export VARIABLE=value # for Bourne, bash, and related shells setenv VARIABLE value # for csh and related shells Bourne is a word from the Anglo-Saxon language of the southern half of England. ...
This article is about the Unix shell. ...
CSH is a three-letter abbreviation with multiple meanings: The United States Army operates combat support hospitals. ...
Unexported environment variables In UNIX, variables may be assigned without the export keyword. Variables defined in this way are displayed by the set command, but are not inherited by the child processes. VARIABLE=value There is no equivalent in the DOS or Windows environments.
Security On Unix, a setuid program is given an environment chosen by its caller, but it runs with different authority from its caller. The dynamic linker will usually load code from locations specified by the environment variables LD_LIBRARY_PATH and LD_PRELOAD and run it with the process's authority. If a setuid program did this, it would be insecure, because its caller could get it to run arbitrary code and hence misuse its authority. For this reason, libc unsets these environment variables at startup in a setuid process. Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®) is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ...
setuid and setgid are Unix terms, which are short for Set User ID and Set Group ID, respectively. ...
In computing, a dynamic linker is the part of an operating system (OS) that loads and links the shared libraries for an executable when it is run. ...
Libc is a software library for the C computer programming language. ...
Common environment variables Examples of DOS environment variables - %COMSPEC%
This variable contains the full path to the command processor, command.com. ComSpec is one of environment variables used in MS-DOS and Microsoft Windows, which by default points to cmd. ...
- %PATH%
This variable contains a semicolon-delimited list of directories in which the command interpreter will search for executable files. Equivalent to the UNIX $PATH variable. Note that %PATH% can also be set like this PATH=c:dos; where SET isn't required. - %TEMP% and %TMP%
These variables contain the path to the directory where temporary files should be stored. Note that in MS-DOS 5 %TEMP% sometimes pointed to C:DOS so removing all files in %TEMP% would cause great problems to say the least, something that the main creator of the Web browser Arachne (web browser) wasn't aware of and thus giving Arachne much unwarranted media criticism. Arachne is a full-screen Internet suite containing a graphical web browser, email client, and dialer. ...
Examples of UNIX environment variables - $PATH
Contains a colon-separated list of directories that the shell searches for commands that do not contain a slash in their name. (Commands with slashes are interpreted as a file name to execute, and the shell attempts to execute them as they are) - $HOME
Contains the location of the user's home directory. Although the current user's home directory can also be found out through the C functions getpwuid and getuid, $HOME is often used for convenience in various shell scripts (and other contexts). - $DISPLAY
Contains the identifier for the display that X11 programs should use by default. In computing, the X Window System (commonly X11 or X) is a windowing system for bitmap displays. ...
- $LD_LIBRARY_PATH
On many Unix systems with a dynamic linker, contains a colon-separated list of directories that the dynamic linker should search for shared objects when building a process image after exec. In computing, a dynamic linker is the part of an operating system (OS) that loads and links the shared libraries for an executable when it is run. ...
In computer science, a library is a collection of subprograms used to develop software. ...
- $LANG, $LC_ALL
LANG expands to the default system locale; LC_ALL can be used to override this. For example, if its value is pt_BR, then the language is set to (Brazilian) Portuguese and the locale to Brazil. In computing, locale is a set of parameters that defines the users language, country and any special variant preferences that the user wants to see in their user interface. ...
Examples from Microsoft Windows Discrete value variables These variables generally expand to discrete values, such as the current working directory, the current date, or a random number. Some of these are true environment variable and will be expanded by all functions that handle environment variables. Others, like %CD% simply look like environment variables and will only be expanded by some functions and shells. For computer operating systems that support a hierarchial file system, the working directory is the directory path that a user or program has designated to be the directory for files referenced by name only, or by a relative path (as contrasted with using both a files name and a...
- %CD%
This variable points to the current directory. Equivalent to the output of the command cd when called without arguments. - %DATE%
This variable expands to the current date. The date is displayed according to the current user's date format preferences. A date in a calendar is a reference to a particular day represented within a calendar system. ...
- %ERRORLEVEL%
This variable points to the current error level. If there was an error in the previous command, this is what you need to check against to find out about that. - %RANDOM%
This variable returns a random number between 0 and 32767 - %TIME%
This variable points to the current time. The time is displayed according to the current user's time format preferences.
System path variables These variables refer to locations of critical operating system resources, and as such generally are not user-dependent. - %AppData%
Contains the full path to the Application Data folder of the logged-in user. Does not work on Windows NT 4.0 SP6 UK. - %ComSpec%
This variable contains the full path to the Windows NT command processor, cmd.exe. ComSpec is one of environment variables used in MS-DOS and Microsoft Windows, which by default points to cmd. ...
- %PATH%
This variable contains a semicolon-delimited list of directories in which the command interpreter will search for executable files. Equivalent to the UNIX $PATH variable. - %ProgramFiles%
This variable points to Program Files directory, which stores all the installed program of Windows and others. The default is C:Program Files. - %CommonProgramFiles%
This variable points to Common Files directory. The default is C:Program FilesCommon Files. - %SystemDrive%
The %SystemDrive% variable is a special system-wide environment variable found on Microsoft Windows NT and its derivatives. Its value is the drive upon which the system folder was placed. Microsoft Corporation, (NASDAQ: MSFT, HKSE: 4338) is a multinational computer technology corporation with global annual revenue of US$44. ...
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. ...
The value of %SystemDrive% is in most cases C:. The system drive cannot be altered once the operating system is running. - %SystemRoot%
The %SystemRoot% variable is a special system-wide environment variable found on Microsoft Windows NT and its derivatives. Its value is the location of the system folder, including the drive and path. The drive is the same as %SystemDrive% and the default path on a clean installation depends upon the version of the operating system. By default on a clean installation, - Windows NT 5.1 (Windows XP) and newer versions by default use WINDOWS
- Windows NT 5.0 (Windows 2000), Windows NT 4.0 and Windows NT 3.1 by default use WINNT
- Windows NT 3.5x by default uses WINNT35
- %WinDir%
This variable points to the Windows directory. If the System is on drive C: then the default values are: Windows XP is a line of operating systems developed by Microsoft for use on general-purpose computer systems, including home and business desktops, notebook computers, and media centers. ...
Windows 2000 (also referred to as Win2K) is a preemptive, interruptible, graphical and business-oriented operating system that was designed to work with either uniprocessor or symmetric multi-processor 32-bit Intel x86 computers. ...
Windows 95 is a consumer-oriented graphical user interface-based operating system. ...
Windows 98 (codenamed Memphis and formerly known as Windows 97) is a graphical operating system released on June 25, 1998 by Microsoft and the successor to Windows 95. ...
Windows Millennium Edition, or Windows Me (IPA pronunciation: [miË], [Ém iË]), is a hybrid 16-bit/32-bit graphical operating system released on September 14, 2000 by Microsoft. ...
Windows Server 2003 is a server operating system produced by Microsoft. ...
Windows NT 4. ...
User management variables These variables store information related to resources and settings owned by various user profiles within the system. As a general rule, these variables do not refer to critical system resources or locations that are necessary for the OS to run. A User Profile (userprofile, or simply profile when used in-context) is a feature of the Microsoft Windows operating system, comprising a given users collection of personal documents and settings on that computer. ...
- %ALLUSERSPROFILE%
The %ALLUSERSPROFILE% variable expands to the full path to the All Users profile directory. This profile contains resources and settings that are used by all system accounts. Shortcut links copied to the All Users' Start menu or Desktop folders will appear in every user's Start menu or Desktop, respectively. Computer shortcuts are small files containing only the location of another file. ...
It has been suggested that this article or section be merged into Desktop_environment. ...
- %UserDomain%
The variable holds the name of the Workgroup or Windows Domain to which the current user belongs. The related variable, %LOGONSERVER%, holds the hostname of the server that authenticated the current user's logon credentials (name and password). For Home PCs, and PCs in a Workgroup, the authenticating server is usually the PC itself. For PCs in a Windows Domain, the authenticating server is a domain controller (a primary domain controller, or PDC, in Windows NT 4-based domains). A computer network is a system for communication among two or more computers. ...
It has been suggested that this article or section be merged into Active Directory. ...
A hostname (occasionally also, a sitename) is the unique name by which a network attached device (which could consist of a computer, file server, network storage device, fax machine, copier, cable modem, etc. ...
On Windows Server Systems, the domain controller (DC) is the server that responds to security authentication requests (logging in, checking permissions, etc. ...
- %UserProfile%
The %UserProfile% variable is a special system-wide environment variable found on Microsoft Windows NT and its derivatives. Its value is the location of the current user's profile directory, in which is found that user's HKCU registry hive (NTUSER). Users can also use the %USERNAME% variable to determine the active users login identification.
Defaults: | %ALLUSERSPROFILE% | C:Documents and SettingsAll Users | | %APPDATA% | C:Documents and Settings{username}Application Data | | %COMPUTERNAME% | {computername} | | %COMSPEC% | C:WindowsSystem32cmd.exe | | %HOMEDRIVE% | C: | | %HOMEPATH% | Documents and Settings{username} | | %PATH% | C:WindowsSystem32;C:Windows;C:WindowsSystem32Wbem | | %PATHEXT% | .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF: .WSH | | %PROGRAMFILES% | C:Program Files | | %PROMPT% | Code for current command prompt format. Code is usually $P$G | | %SYSTEMDRIVE% | The drive containing the Windows XP root directory, usually C: | | %SYSTEMROOT% | The Windows XP root directory, usually C:Windows | | %TEMP% and %TMP% | C:Documents and Settings{username}Local SettingsTemp | | %USERNAME% | {username} | | %USERPROFILE% | C:Documents and Settings{username} | | %WINDIR% | C:Windows | External links - Windows XP Command Shell Overview with a list of environment variables — Microsoft.com
- How To Manage Environment Variables in Windows XP — Microsoft.com
- Environment Variables in Windows XP — Computer Education
- WEVE (Windows Environment Variable Editor) A GUI editor for environment variables in Windows XP — WEVE GUI Editor
- RapidEE (Rapid Environment Editor) — A simple environment variables editor
|