{{more citations needed|date=May 2023}} {{short description|User-definable variable associated with each running process in many operating systems}} {{Use dmy dates|date=April 2019|cs1-dates=y}} {{Use list-defined references|date=January 2022}} <!-- Note to editors regarding embedded anchors: In order to distinguish between environment variables for Unix, DOS and Windows in incoming links, all anchors for Unix/OSX-variables are prefixed with $, all anchors for DOS/MDOS/GEM/NetWare-variables are framed like %variable%, all anchors for OS/2-variables are prefixed with %, and all anchors for Windows-variables are not prefixed at all. Environment variables are listed as they are stored in the environment, although some systems are case-insensitive in regard to their case. If a variable exists in several case-variants, they should be listed separately (f.e. %COMSPEC% and %ComSpec%) and independent anchors should be created for them as well. (At present there are some parsing problem with links to %BETA%, %FBP_USER%, %DAY%, %DAY_OF_WEEK%, %CD%, %DATE%.) -->

An '''environment variable''' is a user-definable value that can affect the way running processes will behave on a computer. Environment variables are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

They were introduced in their modern form in 1979 with Version 7 Unix, so are included in all Unix operating system flavors and variants from that point onward including Linux and macOS. From PC&nbsp;DOS 2.0 in 1982, all succeeding Microsoft operating systems, including Microsoft Windows, and OS/2 also have included them as a feature, although with somewhat different syntax, usage and standard variable names.

== Design == In all Unix and Unix-like systems, as well as on Windows, each process has its own separate set of environment variables. By default, when a process is created, it inherits a duplicate run-time environment of its parent process, except for explicit changes made by the parent when it creates the child. At the API level, these changes must be done between running <code>fork</code> and <code>exec</code>. Alternatively, from command shells such as bash, a user can change environment variables for a particular command invocation by indirectly invoking it via <code>env</code> or using the <code>ENVIRONMENT_VARIABLE=VALUE &lt;command&gt;</code> notation. A running program can access the values of environment variables for configuration purposes.

Shell scripts and batch files use environment variables to communicate data and preferences to child processes. They can also be used to store temporary values for reference later in a shell script. However, in Unix, non-exported variables are preferred for this as they do not leak outside the process.

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. Similarly, changing or removing a variable's value inside a DOS or Windows batch file will change the variable for the duration of <code>COMMAND.COM</code>or <code>CMD.EXE</code>'s existence, respectively.

In Unix, the environment variables are normally initialized during system startup by the system init startup scripts, and hence inherited by all other processes in the system. Users can, and often do, augment them in the profile script for the command shell they are using. In Microsoft Windows, each environment variable's default value is stored in the Windows Registry or set in the <code>AUTOEXEC.BAT</code> file.

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 <code>$LD_LIBRARY_PATH</code> and <code>$LD_PRELOAD</code> 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. setuid programs usually unset unknown environment variables and check others or set them to reasonable values.

In general, the collection of environment variables function as an associative array where both the keys and values are strings. The interpretation of characters in either string differs among systems. When data structures such as lists need to be represented, it is common to use a colon (common on Unix and Unix-like) or semicolon-delineated (common on Windows and DOS) list.

== Syntax == 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.

By convention, names of environment variables are normally expressed in all capital letters. This helps keep environment variables distinctly different from other variables and identifiers used in programming codes. Nevertheless, note that case sensitivity in environment variable names differs between operating systems. That is, Unix-like operating systems are case-sensitive with respect to environment variable names, while DOS, OS/2, and Windows are not case-sensitive.

=== Unix === In most Unix and Unix-like command-line shells, an environment variable's value is retrieved by placing a <code>$</code> sign before the variable's name. If necessary, the name can also be surrounded by braces.

To display the user home directory, the user may type:

<syntaxhighlight lang="bash"> echo $HOME </syntaxhighlight>

In Unix and Unix-like systems, the names of environment variables are case-sensitive.

The command '''<code>env</code>''' displays all environment variables and their values. The command '''<code>printenv</code>''' can also be used to print a single variable by giving that variable name as the sole argument to the command.

=== DOS, OS/2 and Windows === In DOS, OS/2 and Windows command-line interpreters such as <code>COMMAND.COM</code> and <code>CMD.EXE</code>, an environment variable is retrieved by placing a <code>%</code> sign before and after it.

In DOS, OS/2 and Windows command-line interpreters as well as their API, upper or lower case is not distinguished for environment variable names.

The environment variable named <code>HOMEDRIVE</code> contains the drive letter (plus its trailing <code>:</code> colon) of the user's home directory, whilst <code>HOMEPATH</code> contains the full path of the user's home directory within that drive.

So to see the home drive and path, the user may type this:

<syntaxhighlight lang="batch"> ECHO %HOMEDRIVE%%HOMEPATH% </syntaxhighlight>

The command '''<code>SET</code>''' (with no arguments) displays all environment variables and their values. In Windows NT and later <code>set</code> can also be used to print all variables whose name begins with a given prefix by giving the prefix as the sole argument to the command.

In Windows PowerShell, the user may type the following:

<syntaxhighlight lang="powershell"> "$Env:HomeDrive$Env:HomePath" </syntaxhighlight>

or one of the following redundant equivalents:

<syntaxhighlight lang="powershell"> Write-Output "$Env:HomeDrive$Env:HomePath" echo "$Env:HomeDrive$Env:HomePath" write "$Env:HomeDrive$Env:HomePath" return "$Env:HomeDrive$Env:HomePath" Write-Host "$Env:HomeDrive$Env:HomePath" </syntaxhighlight>

In PowerShell, upper or lower case is not distinguished for environment variable names.

The following command displays all environment variables and their values:

<syntaxhighlight lang="powershell"> Get-ChildItem env: </syntaxhighlight>

=== Assignment: Unix === The commands <code>env</code> and <code>set</code> can be used to set environment variables and are often incorporated directly into the shell.

The following commands can also be used, but are often dependent on a certain shell.

''VARIABLE''=''value'' # (there must be no spaces around the equals sign) export ''VARIABLE'' # for Bourne and related shells

export ''VARIABLE''=''value'' # for ksh, bash, and related shells

setenv ''VARIABLE'' ''value'' # for csh and related shells

A few simple principles govern how environment variables achieve their effect.

Environment variables are local to the process in which they were set. If two shell processes are spawned and the value of an environment variable is changed in one, that change will not be seen by the other.

When a child process is created, it inherits all the environment variables and their values from the parent process. Usually, when a program calls another program, it first creates a child process by forking, then the child adjusts the environment as needed and lastly the child replaces itself with the program to be called. This procedure gives the calling program control over the environment of the called program.

In Unix shells, variables may be assigned without the '''<code>export</code>''' keyword. Variables defined in this way are displayed by the '''<code>set</code>''' command, but are ''not'' true environment variables, as they are stored only by the shell and are unknown to all other processes. The <code>printenv</code> command will not display them, and child processes do not inherit them.

''VARIABLE''=''value''

The prefix syntax exports a "true" environment variable to a child process without affecting the current process:<ref name="ClassicShS"/> ''VARIABLE''=''value'' program_name [arguments]

The persistence of an environment variable can be session-wide or system-wide.

'''<code>unset</code>''' is a builtin command implemented by both the Bourne shell family (<code>sh</code>, <code>ksh</code>, <code>bash</code>, etc.) and the C shell family (csh, tcsh, etc.) of Unix command line shells. It unsets a shell variable, removing it from memory and the shell's exported environment. It is implemented as a shell builtin, because it directly manipulates the internals of the shell.<ref name="OG_unset"/><ref name="Bash_unset"/> Read-only shell variables cannot be unset. If one tries to unset a read-only variable, the <code>unset</code> command will print an error message and return a non-zero exit code.

=== Assignment: DOS, OS/2 and Windows === In DOS, OS/2 and Windows command-line interpreters such as <code>COMMAND.COM</code> and <code>CMD.EXE</code>, the '''<code>SET</code>''' command is used to assign environment variables and values using the following arguments: <syntaxhighlight lang="batch"> SET VARIABLE=value </syntaxhighlight> An environment variable is removed via: <syntaxhighlight lang="batch"> SET VARIABLE= </syntaxhighlight>

The '''<code>SET</code>''' command without any arguments displays all environment variables along with their values; '''<code>SET &quot;&nbsp;&quot;</code>''', zero or more spaces, will include internal variables too. In <code>CMD.EXE</code>, it is possible to assign local variables that will not be global using the '''<code>SETLOCAL</code>''' command and '''<code>ENDLOCAL</code>''' to restore the environment.

Use the switch '''<code>/?</code>''' to display the internal documentation, or use the viewer '''<code>help</code>''': <syntaxhighlight lang="batch"> SET /? HELP SET SETLOCAL /? HELP SETLOCAL </syntaxhighlight>

In PowerShell, the assignment follows a syntax similar to Unix:

<syntaxhighlight lang="powershell"> $env:VARIABLE = "VALUE" </syntaxhighlight>

=== Assignment: PHP === In PHP the <code>putenv()</code> function should be used.<ref>{{cite web |title=putenv() |url=https://www.php.net/manual/en/function.putenv.php |website=PHP Manual |publisher=The PHP Documentation Group |access-date=2025-10-31 |archive-date=2025-11-09 |archive-url=https://web.archive.org/web/20251109080315/https://www.php.net/manual/en/function.putenv.php |url-status=live }}</ref><ref>{{cite web |title=putenv() PHP Function |url=https://doc.raided.eu/web/php/functions/putenv/ |website=The Raided Foundation Docs |publisher=the Raided Foundation |access-date=2025-10-31 |archive-date=2025-10-31 |archive-url=https://web.archive.org/web/20251031202541/https://doc.raided.eu/web/php/functions/putenv/ |url-status=live }}</ref> <syntaxhighlight lang="php"> putenv("VARIABLE_NAME"="VALUE"); </syntaxhighlight>

== Examples == Examples of environment variables include:

* <code>PATH</code>: a list of directory paths. When the user types a command without providing the full path, this list is checked to see whether it contains a path that leads to the command. * <code>HOME</code> (Unix-like) and <code>USERPROFILE</code> (Microsoft Windows): indicate where a user's home directory is located in the file system. * <code>HOME/{.AppName}</code> (Unix-like) and <code>APPDATA\{DeveloperName\AppName}</code> (Microsoft Windows): for storing application settings. Many applications incorrectly use <code>USERPROFILE</code> for application settings in Windows: <code>USERPROFILE</code> should only be used in dialogs that allow user to choose between paths like <code>Documents/Pictures/Downloads/Music</code>; for programmatic purposes, <code>APPDATA</code> (for roaming application settings shared across multiple devices), <code>LOCALAPPDATA</code> (for local application settings) or <code>PROGRAMDATA</code> (for application settings shared between multiple OS users) should be used.<ref name="appdata"/> * <code>TERM</code> (Unix-like): specifies the type of computer terminal or terminal emulator being used (e.g., <code>vt100</code> or <code>dumb</code>). * <code>PS1</code> (Unix-like): specifies how the prompt is displayed in the Bourne shell and variants. * <code>MAIL</code> (Unix-like): used to indicate where a user's mail is to be found. * <code>TEMP</code>: location where processes can store temporary files.

== True environment variables ==

==={{anchor|UNIX-ENV}}Unix === {{anchor|$PATH}} {{See also|Path (computing)}} ;<code>$PATH</code>: 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 file names to execute, and the shell attempts to execute the files directly). It is equivalent to the DOS, OS/2 and Windows <code>%PATH%</code> variable.

;{{anchor|$HOME}}<code>$HOME</code>: 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 <code>getpwuid</code> and <code>getuid</code>, <code>$HOME</code> is often used for convenience in various shell scripts (and other contexts). Using the environment variable also gives the user the possibility to point to another directory.

;{{anchor|$PWD}}<code>$PWD</code>: This variable points to the current directory. Equivalent to the output of the command pwd when called without arguments.

;{{anchor|$DISPLAY}}<code>$DISPLAY</code>: Contains the identifier for the display that X11 programs should use by default.

;{{anchor|$LD_LIBRARY_PATH}}<code>$LD_LIBRARY_PATH</code>: 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 <code>exec</code>, before searching in any other directories.

;{{anchor|$LIBPATH}}<code>$LIBPATH</code> or <code>$SHLIB_PATH</code>: Alternatives to <code>$LD_LIBRARY_PATH</code> typically used on older Unix versions.

;{{anchor|$LANG|$LC_ALL|$LC_CTYPE|$LC_COLLATE|$LC_DATE}}<code>$LANG, $LC_ALL, $LC_...</code>: <code>$LANG</code> is used to set to the default locale. For example, if the locale values are <code>pt_BR</code>, then the language is set to (Brazilian) Portuguese and Brazilian practice is used where relevant. Different aspects of localization are controlled by individual <code>$LC_</code>-variables (<code>$LC_CTYPE</code>, <code>$LC_COLLATE</code>, <code>$LC_DATE</code> etc.). <code>$LC_ALL</code> can be used to force the same locale for all aspects.

;{{anchor|$TZ}}<code>$TZ</code>: Refers to time zone. It can be in several formats, either specifying the time zone itself or referencing a file (in <code>/usr/share/zoneinfo</code>).

;{{anchor|$BROWSER}}<code>$BROWSER</code>: Contains a colon-separated list of a user's web browser preferences, for use by programs that need to allow the user to view content at a URL. The browsers in the list are intended to be attempted from first to last, stopping after the first one that succeeds. This arrangement allows for fallback behavior in different environments, e.g., in an X11 environment, a graphical browser (such as Firefox) can be used, but in a console environment a terminal-base browser (such as Lynx) can be used. A <code>%s</code> token may be present to specify where the URL should be placed; otherwise the browser should be launched with the URL as the first argument.<ref name="ESR_2002_BROWSER"/><ref name="LWN_2001_BROWSER"/><ref name="PERL_ENV_BROWSER"/><ref name="PYTHON_WEBBROWSER"/><ref name="DEBIAN_DFLT_WEB_BROWSER"/>

==={{anchor|DOS-ENV}}DOS === {{anchor|Pre-environment|System environment|Master environment|Local environment|Pre-environment variable|System environment variable|Master environment variable|Local environment variable}} Under DOS, the ''master environment'' is provided by the primary command processor, which inherits the ''pre-environment'' defined in <code>CONFIG.SYS</code> when first loaded. Its size can be configured through the <code>COMMAND /E:n</code> parameter between 160<ref name="4DOS_8.00_HELP"/><!-- DR-DOS COMMAND: 128, MDOS: 120 --> and 32767<ref name="4DOS_8.00_HELP"/><!-- DR-DOS COMMAND: 32751 --> bytes. ''Local environment'' segments inherited to child processes are typically reduced down to the size of the contents they hold. Some command-line processors (like 4DOS) allow to define a minimum amount of free environment space that will be available when launching secondary shells.<ref name="4DOS_8.00_HELP"/> While the content of environment variables remains unchanged upon storage, their names (without the "<code>%</code>") are always converted to uppercase, with the exception of ''pre-environment variables'' defined via the <code>CONFIG.SYS</code> directive <code>SET</code> under DR DOS 6.0 and higher<ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_1997_4DOSTIP"/> (and only with <code>SWITCHES=/L</code> (for "allow lowercase names") under DR-DOS 7.02 and higher).<ref name="4DOS_8.00_HELP"/><ref name="Paul_1997_OD-A3"/> In principle, MS-DOS 7.0 and higher also supports lowercase variable names (<code>%windir%</code>), but provides no means for the user to define them.<!-- but WIN.COM can set %windir% --> Environment variable names containing lowercase letters are stored in the environment just like normal environment variables, but remain invisible to most DOS software, since they are written to expect uppercase variables only.<ref name="4DOS_8.00_HELP"/><ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_1997_4DOSTIP"/> Some command processors<!-- such as 4DOS --> limit the maximum length of a variable name to 80 characters.<ref name="4DOS_8.00_HELP"/> While principally only limited by the size of the ''environment segment'', some DOS and 16-bit Windows programs<ref name="4DOS_8.00_HELP"/><ref group="nb" name="NB_ENVLEN128"/> do not expect the contents of environment variables to exceed 128 characters. DR-DOS <code>COMMAND.COM</code> supports environment variables up to 255<!-- not 256 -->, 4DOS even up to 512 characters.<ref name="4DOS_8.00_HELP"/> Since <code>COMMAND.COM</code> can be configured (via <code>/L:128..1024</code>) to support command lines up to 1024 characters internally under MS-DOS 7.0 and higher, environment variables should be expected to contain at least 1024 characters as well. In some versions of DR-DOS, the environment passed to drivers, which often do not need their environment after installation, can be shrunken or relocated through <code>SETENV</code> or <code>[[INSTALL (CONFIG.SYS directive)|INSTALL[HIGH]]]</code>/<code>LOADHIGH</code> options <code>/Z</code> (zero environment), <code>/D[:loaddrive]</code> (substitute drive, e.g. <code>B:TSR.COM</code>) and <code>/E</code> (relocate environment above program) in order to minimize the driver's effectively resulting resident memory footprint.<ref name="Paul_1997_SETENV"/><ref name="Paul_1997_OD-A3"/><ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_2002_CTMOUSE"/><ref name="PTS-DOS_2000"/><ref name="Paul_2002_COM"/>

In batch mode, non-existent environment variables are replaced by a zero-length string.

{{anchor|Reserved environment variable}}''Standard environment variables''<!-- DR-DOS term --> or ''reserved environment variables'' include:

;{{anchor|%APPEND%}}<code>%APPEND%</code> (supported since DOS 3.3): This variable contains a semicolon-delimited list of directories in which to search for files. It is usually changed via the <code>APPEND /E</code> command, which also ensures that the directory names are converted into uppercase. Some DOS software actually expects the names to be stored in uppercase and the length of the list not to exceed 121<ref name="4DOS_8.00_HELP"/> characters, therefore the variable is best not modified via the <code>SET</code> command. Long filenames containing spaces or other special characters must not be quoted (<code>"</code>).

;{{anchor|%CONFIG%}}<code>%CONFIG%</code> (supported since MS-DOS 6.0 and PC DOS 6.1, also supported by ROM-DOS<ref name="Datalight_2005_ROM-DOS"/>): This variable holds the symbolic name of the currently chosen boot configuration. It is set by the DOS BIOS (<code>IO.SYS</code>, <code>IBMBIO.COM</code>, etc.) to the name defined by the corresponding <code>CONFIG.SYS</code> directive <code>MENUITEM</code> before launching the primary command processor. Its main purpose is to allow further special cases in <code>AUTOEXEC.BAT</code> and similar batchjobs depending on the selected option at boot time. This can be emulated under DR-DOS by utilizing the <code>CONFIG.SYS</code> directive <code>SET</code> like <code>SET CONFIG=1</code>.

;{{anchor|%CMDLINE%}}<code>%CMDLINE%</code> (introduced with 4DOS, also supported since MS-DOS 7.0): This variable contains the fully expanded text of the currently executing command line. It can be read by applications to detect the usage of and retrieve long command lines, since the traditional method to retrieve the command line arguments through the PSP (or related API functions) is limited to 126 characters and is no longer available when FCBs get expanded or the default DTA is used. While 4DOS supports longer command lines, <code>COMMAND.COM</code> still only supports a maximum of 126 characters at the prompt by default (unless overridden with <code>/U:128..255</code> to specify the size of the command line buffer), but nevertheless internal command lines can become longer through f.e. variable expansion (depending on <code>/L:128..1024</code> to specify the size of the internal buffer). In addition to the command-line length byte in the PSP, the PSP command line is normally limited by ASCII-13, and command lines longer than 126 characters will typically be truncated by having an ASCII-13 inserted at position 127,<ref name="Paul_1997_4DOSTIP"/> but this cannot be relied upon in all scenarios.<ref name="Paul_1997_4DOSTIP"/><ref group="nb" name="NB_CMDLINE"/> The variable will be suppressed for external commands invoked with a preceding <code>@</code>-symbol like in <code>@XCOPY ...</code> for backward compatibility and in order to minimize the size of the environment when loading non-relocating terminate-and-stay-resident programs. Some beta versions of Windows Chicago used <code>%CMDLINE%</code> to store only the remainder of the command line excessing 126 characters instead of the complete command line.<ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_1997_4DOSTIP"/>

;{{anchor|%COMSPEC%}}<code>%COMSPEC%</code> (supported since DOS 2.0): This variable contains the full 8.3 path to the command processor, typically <code>C:\COMMAND.COM</code> or <code>C:\DOS\COMMAND.COM</code>. It must not contain long filenames, but under DR-DOS it may contain file and directory passwords. It is set up by the primary command processor to point to itself (typically reflecting the settings of the <code>CONFIG.SYS</code> directive <code>SHELL</code>), so that the resident portion of the command processor can reload its transient portion from disk after the execution of larger programs. The value can be changed at runtime to reflect changes in the configuration, which would require the command processor to reload itself from other locations. The variable is also used when launching secondary shells.

;{{anchor|%COPYCMD%}}<code>%COPYCMD%</code> (supported since MS-DOS 6.2 and PC DOS 6.3, also supported by ROM-DOS<ref name="Datalight_2005_ROM-DOS"/>): Allows a user to specify the <code>/Y</code> switch (to assume "Yes" on queries) as the default for the <code>COPY</code>, <code>XCOPY</code>, and <code>MOVE</code> commands. A default of <code>/Y</code> can be overridden by supplying the <code>/-Y</code> switch on the command line. The <code>/Y</code> switch instructs the command to replace existing files without prompting for confirmation.

;{{anchor|%DIRCMD%}}<code>%DIRCMD%</code> (supported since MS-DOS 5.0 and PC DOS 5.0, also supported by ROM-DOS<ref name="Datalight_2005_ROM-DOS"/>): Allows a user to specify customized default parameters for the <code>DIR</code> command, including file specifications. Preset default switches can be overridden by providing the negative switch on the command line. For example, if <code>%DIRCMD%</code> contains the <code>/W</code> switch, then it can be overridden by using <code>DIR /-W</code> at the command line. This is similar to the environment variable <code>%$DIR%</code> under DOS Plus<ref name="Kotulla_1987_Environment"/> and a facility to define default switches for <code>DIR</code> through its <code>/C</code> or <code>/R</code> switches under DR-DOS <code>COMMAND.COM</code>.<ref name="Paul_1997_NWDOSTIP"/> <code>%DIRCMD%</code> is also supported by the external <code>SDIR.COM</code>/<code>DIR.COM</code> Stacker commands under Novell DOS 7 and higher.<ref name="Paul_1997_NWDOSTIP"/>

;{{anchor|%LANG%}}<code>%LANG%</code> (supported since MS-DOS 7.0): This variable is supported by some tools to switch the locale for messages in multilingual issues.

;{{anchor|%LANGSPEC%}}<code>%LANGSPEC%</code> (supported since MS-DOS 7.0): This variable is supported by some tools to switch the locale for messages in multilingual issues.

;{{anchor|%NO_SEP%}}<code>%NO_SEP%</code> (supported since PC DOS 6.3 and DR-DOS 7.07): This variable controls the display of thousands-separators in messages of various commands. Issued by default, they can be suppressed by specifying <code>SET NO_SEP=ON</code> or <code>SET NO_SEP=1</code> under PC&nbsp;DOS. DR-DOS additionally allows to override the system's thousands-separator displayed as in f.e. <code>SET NO_SEP=.</code>.<ref name="4DOS_8.00_HELP"/>

;{{anchor|%PATH%}}<code>%PATH%</code> (supported since DOS 2.0): This variable contains a semicolon-delimited list of directories in which the command interpreter will search for executable files. Equivalent to the Unix <code>$PATH</code> variable (but some DOS and Windows applications also use the list to search for data files similar to <code>$LD_LIBRARY_PATH</code> on Unix-like systems). It is usually changed via the <code>PATH</code> (or <code>PATH /E</code> under MS-DOS 6.0) command, which also ensures that the directory names are converted into uppercase. Some DOS software actually expects the names to be stored in uppercase and the length of the list not to exceed 123<ref name="4DOS_8.00_HELP"/> characters,<ref group="nb" name="NB_ENVLEN128"/> therefore the variable should better not be modified via the <code>SET</code> command.<ref name="4DOS_8.00_HELP"/> Long filenames containing spaces or other special characters must not be quoted (<code>"</code>). By default, the current directory is searched first, but some command-line processors like 4DOS allow "<code>.</code>" (for "current directory") to be included in the list as well in order to override this search order; some DOS programs are incompatible with this extension.<ref name="4DOS_8.00_HELP"/>

;{{anchor|%PROMPT%}}<code>%PROMPT%</code> (supported since DOS 2.0): This variable contains a <code>$</code>-tokenized string defining the display of the prompt. It is usually changed via the <code>PROMPT</code> command.

;{{anchor|%TEMP%|%TMP%}}<code>%TEMP%</code> (and <code>%TMP%</code>): These variables contain the path to the directory where temporary files should be stored. Operating system tools typically only use <code>%TEMP%</code>, whereas third-party programs also use <code>%TMP%</code>. Typically <code>%TEMP%</code> takes precedence over <code>%TMP%</code>.

The DR-DOS family supports a number of additional ''standard environment variables''<!-- DR-DOS term --> including:

;{{anchor|%BETA%}}<code>%BETA%</code>: This variable contains an optional message displayed by some versions (including DR DOS 3.41<!-- not supported by DR DOS 3.31-3.40 -->) of <code>COMMAND.COM</code> at the startup of secondary shells.<ref name="Paul_2002_CLS"/>

;{{anchor|%DRDOSCFG%|%NWDOSCFG%|%OPENDOSCFG%}}<code>%DRDOSCFG%</code>/<code>%NWDOSCFG%</code>/<code>%OPENDOSCFG%</code>: This variable contains the directory<ref name="Caldera_1998_USER"/> (without trailing "<code>\</code>") where to search for <code>.INI</code> and <code>.CFG</code> configuration files (that is, DR-DOS application specific files like <code>TASKMGR.INI</code>, <code>TASKMAX.INI</code>, <code>VIEWMAX.INI</code>, <code>FASTBACK.CFG</code> etc., class specific files like <code>COLORS.INI</code>, or global files like <code>DRDOS.INI</code>, <code>NWDOS.INI</code>, <code>OPENDOS.INI</code>, or <code>DOS.INI</code>), as used by the <code>INSTALL</code> and <code>SETUP</code> commands and various DR-DOS programs like <code>DISKOPT</code>, <code>DOSBOOK</code>, <code>EDIT</code>, <code>FBX</code>, <code>FILELINK</code>, <code>LOCK</code>, <code>SECURITY.OVL</code>/<code>NWLOGIN.EXE</code>, <code>SERNO</code>, <code>TASKMAX</code>, <code>TASKMGR</code>, <code>VIEWMAX</code>, or <code>UNDELETE</code>.<ref name="Paul_1997_NWDOSTIP"/> It must not contain long filenames.

;{{anchor|%DRCOMSPEC%}}<code>%DRCOMSPEC%</code>: This variable optionally holds an alternative path to the command processor taking precedence over the path defined in the <code>%COMSPEC%</code> variable, optionally including file and directory passwords. Alternatively, it can hold a special value of "<code>ON</code>" or "<code>1</code>" in order to enforce the usage of the <code>%COMSPEC%</code> variable even in scenarios where the <code>%COMSPEC%</code> variable may point to the wrong command-line processor, for example, when running some versions of the DR-DOS <code>SYS</code> command under a foreign operating system.<ref name="Paul_2017"/>

;{{anchor|%DRSYS%}}<code>%DRSYS%</code>: Setting this variable to "<code>ON</code>" or "<code>1</code>" will force some versions of the DR-DOS <code>SYS</code> command to work under foreign operating systems instead of displaying a warning.<ref name="Paul_2017"/>

;{{anchor|%FBP_USER%|FBP_USER}}<code>%FBP_USER%</code>: Specifies the user name used by the FastBack command <code>FBX</code> and <code>{user}.FB</code> configuration files under Novell DOS 7.<ref name="Paul_1997_NWDOSTIP"/>

;{{anchor|%HOMEDIR%}}<code>%HOMEDIR%</code>: This variable may contain the home directory under DR-DOS (including DR DOS 5.0 and 6.0).<ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_2002_CLS"/>

;{{anchor|%INFO%}}<code>%INFO%</code>: In some versions of DR-DOS <code>COMMAND.COM</code> this variable defines the string displayed by the <code>$I</code> token of the <code>PROMPT</code> command.<ref name="Paul_2002_CLS"/> It can be used, for example, to inform the user how to exit secondary shells.

;{{anchor|%LOGINNAME%}}<code>%LOGINNAME%</code>: In some versions of DR-DOS <code>COMMAND.COM</code> this variable defines the user name displayed by the <code>$U</code> token of the <code>PROMPT</code> command, as set up by f.e. login scripts for Novell NetWare.<ref name="4DOS_8.00_HELP"/><ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_2002_CLS"/> See also the similarly named pseudo-variable <code>%LOGIN_NAME%</code>.

;{{anchor|%MDOS_EXEC%}}<code>%MDOS_EXEC%</code>: This variable can take the values "<code>ON</code>" or "<code>OFF</code>" under Multiuser DOS.<!-- f.e CCI Multiuser DOS 7.22 GOLD --> If enabled, the operating system permits applications to shell out to secondary shells with the DOS Program Area (DPA) freed in order to have maximum DOS memory available for secondary applications instead of running them in the same domain as under DOS.<ref name="CCI_1997_HELP"/><ref name="CCI_1997_PRINTDOC"/>

;{{anchor|%NOCHAR%}}<code>%NOCHAR%</code>: This variable can be used to define the character displayed by some commands in messages for "No" in <code>[Y,N]</code> queries, thereby overriding the current system default (typically "<code>N</code>" in English versions of DR-DOS). If it contains a string, only the first character, uppercased, will be taken. Some commands also support a command line parameter <code>/Y</code> to automatically assume "Yes" on queries, thereby suppressing such prompts. If, however, the parameter <code>/Y:yn</code> is used to specify the "Yes"/"No" characters (thereby overriding any <code>%NOCHAR%</code> setting), queries are not suppressed. See also the related <code>CONFIG.SYS</code> directive <code>NOCHAR</code> and the environment variable <code>%YESCHAR%</code>.<ref name="Paul_2017"/>

;{{anchor|%NOSOUND%}}<code>%NOSOUND%</code>: Setting this variable to "<code>ON</code>" or "<code>1</code>" will disable default beeps issued by some DR-DOS commands in certain situations such as to inform the user of the completion of some operation, that user interaction is required, or when a wrong key was pressed. Command line options to specifically enable certain beeps will override this setting.

;{{anchor|%OS%}}<code>%OS%</code>:This variable contains the name of the operating system in order to distinguish between different DOS-related operating systems of Digital Research-origin in batch jobs and applications.<ref name="Caldera_1998_USER"/> Known values include "<code>DOSPLUS</code>" (DOS Plus 1.2 in DOS emulation), "<code>CPCDOS 4.1</code>" (DOS Plus 1.2 in CP/M emulation), "<code>DRDOS</code>" (DR DOS 3.31-6.0, DR DOS Panther, DR DOS StarTrek, DR-DOS 7.02<ref name="Caldera_1998_USER"/>-7.05), "<code>EZDOS</code>" (EZ-DOS 3.41), "<code>PALMDOS</code>" and "<code>NetWare PalmDOS</code>" (PalmDOS 1.0), "<code>NWDOS</code>" (Novell DOS 7), "<code>NWDOS7</code>" (Novell DOS 7 Beta<!-- BETA 1 (1993-04-26) -->), "<code>OPENDOS</code>" (Caldera OpenDOS 7.01, Caldera DR-OpenDOS 7.02), "<code>CDOS</code>" (Concurrent DOS, Concurrent DOS XM), "<code>CPCDOS</code>" (Concurrent PC DOS), "<code>CDOS386</code>" (Concurrent DOS 386), "<code>DRMDOS</code>" (DR Multiuser DOS), "<code>MDOS</code>" (CCI Multiuser DOS<!-- Gold/Plus/Light -->),<ref name="CCI_1997_HELP"/> "<code>IMSMDOS</code>" (IMS Multiuser DOS), "<code>REAL32</code>" (REAL/32).<ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_2002_OS"/> MS-DOS <code>INTERSVR</code> looks for a value of "<code>DRDOS</code>" as well.<ref name="Paul_2002_OS"/> See also the identically named environment variable <code>%OS%</code> later introduced in the Windows NT family.

;{{anchor|%PEXEC%}}<code>%PEXEC%</code>: In some versions of DR-DOS this variable defines the command executed by the <code>$X</code> token of the <code>PROMPT</code> command before <code>COMMAND.COM</code> displays the prompt after returning from external program execution.<ref name="Paul_1997_NWDOSTIP"/><ref name="Caldera_1998_USER"/>

;{{anchor|%SWITCHAR%}}<code>%SWITCHAR%</code>: This variable defines the SwitChar to be used for argument parsing by some DR-DOS commands. If defined, it overrides the system's current SwitChar setting. The only accepted characters are "<code>/</code>" (DOS style), "<code>-</code>" (Unix style) and "<code>[</code>" (CP/M style). See also the related <code>CONFIG.SYS</code> directive <code>SWITCHAR</code> (to set the system's SwitChar setting) and the <code>%/%</code> ''system information variable'' in some issues of DR-DOS <code>COMMAND.COM</code> (to retrieve the current setting for portable batchjobs).

;{{anchor|%TASKMGRWINDIR%}}<code>%TASKMGRWINDIR%</code>: This variable specifies the directory, where the Windows <code>SYSTEM.INI</code> to be used by the DR-DOS <code>TASKMGR</code> multitasker is located, overriding the default procedure to locate the file.<ref name="Paul_1997_NWDOSTIP"/>

;{{anchor|%VER%}}<code>%VER%</code>: This variable contains the version of the operating system in order to distinguish between different versions of DR-DOS in batch jobs and in the display of the <code>VER</code> command.<ref name="Caldera_1998_USER"/> It is also used for the <code>$V</code> token of the <code>PROMPT</code> command and affects the value returned by the ''system information variable'' <code>%OS_VERSION%</code>. Known values include "<code>1.0</code>" (PalmDOS 1.0), "<code>1.2</code>" (DOS Plus 1.2 in DOS emulation), "<code>2.0</code>" (Concurrent DOS 386 2.0), "<code>3.0</code>" (Concurrent DOS 386 3.0), "<code>3.31</code>" (DR DOS 3.31), "<code>3.32</code>" (DR DOS 3.32), "<code>3.33</code>" (DR DOS 3.33), "<code>3.34</code>" (DR DOS 3.34), "<code>3.35</code>" (DR DOS 3.35), "<code>3.40</code>" (DR DOS 3.40), "<code>3.41</code>" (DR DOS 3.41, EZ-DOS 3.41), "<code>3.41T</code>" (DR DOS 3.41T), "<code>4.1</code>" (Concurrent PC DOS 4.1), "<code>5.0</code>" (DR DOS 5.0, DR Multiuser DOS 5.0), "<code>5.1</code>" (Novell DR Multiuser DOS 5.1), "<code>6.0</code>" (DR Concurrent DOS XM 6.0, DR DOS 6.0), "<code>6.2</code>" (DR Concurrent DOS XM 6.2), "<code>7</code>" (Novell DOS 7, Caldera OpenDOS 7.01, DR-DOS 7.02-7.05), "<code>7.00</code>" (CCI Multiuser DOS 7.00), "<code>7.07</code>" (DR-DOS 7.07), "<code>7.1</code>" (IMS Multiuser DOS 7.1), "<code>7.21</code>" (CCI Multiuser DOS 7.21),<ref name="CCI_1997_HELP"/> "<code>7.22</code>" (CCI Multiuser DOS 7.22) etc.<ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_2002_OS"/><ref name="CCI_1997_HELP"/>

;{{anchor|%YESCHAR%}}<code>%YESCHAR%</code>:This variable can be used to define the character displayed by some commands in messages for "Yes" in <code>[Y,N]</code> queries, thereby overriding the current system default (typically "<code>Y</code>" in English versions of DR-DOS). If it contains a string, only the first character, uppercased, will be taken. Some commands also support a command line parameter <code>/Y</code> to automatically assume "Yes" on queries, thereby suppressing such prompts. If, however, the parameter <code>/Y:y</code> is used to specify the "Yes" character (thereby overriding any <code>%YESCHAR%</code> setting), queries are not suppressed. See also the related <code>CONFIG.SYS</code> directive <code>YESCHAR</code> and the environment variable <code>%NOCHAR%</code>.<ref name="Paul_2017"/>

;{{anchor|%$CLS%}}<code>%$CLS%</code>: This variable defines the control sequence to be sent to the console driver to clear the screen when the <code>CLS</code> command is issued, thereby overriding the internal default ("<code>←[2J</code>" under DR-DOS, "<code>←E</code>" under DOS Plus 1.2 on Amstrad machines<ref name="Kotulla_1987_Environment"/> as well as under Concurrent DOS, Multiuser DOS, and REAL/32 for VT52 terminals, or "<code>←+</code>" under Multiuser DOS for ASCII terminals).<ref name="CCI_1997_HELP"/> If the variable is not defined and no <code>ANSI.SYS</code> console driver is detected, the DR-DOS <code>COMMAND.COM</code> will directly clear the screen via <code>INT 10h/AH=00h</code> BIOS function, like MS-DOS/PC&nbsp;DOS <code>COMMAND.COM</code> does. A special <code>\nnn</code>-notation for octal numbers is supported to allow the definition of special characters like ESC (ASCII-27 = "←" = 1Bh = 33o), as f.e. in <code>SET $CLS=\033[2J</code>. To send the backslash ("<code>\</code>") itself, it can be doubled "<code>\\</code>".<ref name="Paul_1997_NWDOSTIP"/><ref name="Paul_2002_CLS"/><ref name="CCI_1997_HELP"/>

;{{anchor|%$DIR%}}<code>%$DIR%</code>: Supported by DOS Plus accepting the values "L" (long) or "W" (wide) to change the default layout of directory listings with DIR. Can be overridden using the command line options <code>/L</code> or <code>/W</code>.<ref name="Paul_2002_CLS"/><ref name="Kotulla_1987_Environment"/> See also the similar environment variable <code>%DIRCMD%</code> and the <code>DIR</code> options <code>/C</code> and <code>/R</code> of the DR-DOS COMMAND.COM.<ref name="Paul_1997_NWDOSTIP"/>

;{{anchor|%$PAGE%}}<code>%$PAGE%</code>: Supported by DOS Plus accepting the values "<code>ON</code>" or "<code>OFF</code>" for pagination control. Setting this to "<code>ON</code>" has the same affect as adding <code>/P</code> to commands supporting it (like DIR or TYPE).<ref name="Paul_2002_CLS"/><ref name="Kotulla_1987_Environment"/>

;{{anchor|%$LENGTH%}}<code>%$LENGTH%</code>: Used by DOS Plus to define the screen length of the console in lines. This is used to control in a portable way when the screen output should be temporarily halted until a key is pressed in conjunction with the <code>/P</code> option supported by various commands or with automatic pagnination.<ref name="Paul_2002_CLS"/><ref name="Kotulla_1987_Environment"/> See also the related environment variables <code>%$WIDTH%</code> and <code>%DIRSIZE%</code> as well as the similar pseudo-variable <code>%_ROWS%</code>.

;{{anchor|%$WIDTH%}}<code>%$WIDTH%</code>: Used by DOS Plus to define the screen width of the console in columns. This is used to control in a portable way the formatting of the screen output of commands like <code>DIR /W</code> or <code>TYPE filename</code>.<ref name="Paul_2002_CLS"/><ref name="Kotulla_1987_Environment"/> See also the related environment variables <code>%$LENGTH%</code> and <code>%DIRSIZE%</code> as well as the similar pseudo-variable <code>%_COLUMNS%</code>.

;{{anchor|%$SLICE%}}<code>%$SLICE%</code>: Used by DOS Plus accepting a numerical value to control the foreground/background time slicing of multitasking programs.<ref name="Paul_2002_CLS"/><ref name="Kotulla_1987_Environment"/> See also the DOS Plus command <code>SLICE</code>.

;{{anchor|%$ON%}}<code>%$ON%</code>: This variable can hold an optional control sequence to switch text highlighting, reversion or colorization on. It is used to emphasize or otherwise control the display of the file names in commands like <code>TYPE wildcard</code>, for example <code>SET $ON=\033[1m</code> with ANSI.SYS loaded or <code>SET $ON=\016</code> for an IBM or ESC/P printer. For the special <code>\nnn</code> octal notation supported, see <code>%$CLS%</code>.<ref name="Paul_1997_NWDOSTIP"/><ref name="Kotulla_1987_Environment"/> While the variable is undefined by default under DOS Plus and DR-DOS, the Multiuser DOS default for an ASCII terminal equals <code>SET $ON=\033p</code>.<ref name="Paul_2002_CLS"/><ref name="CCI_1997_HELP"/> See also the related environment variable <code>%$OFF%</code>.

;{{anchor|%$OFF%}}<code>%$OFF%</code>: This variable can hold an optional control sequence to switch text highlighting, reversion or colorization off. It is used to return to the normal output after the display of file names in commands like <code>TYPE wildcard</code>, for example <code>SET $OFF=\033[0m</code> with ANSI.SYS loaded or <code>SET $OFF=\024</code> for an IBM or ESC/P printer. For the special <code>\nnn</code> octal notation supported, see <code>%$CLS%</code>.<ref name="Paul_1997_NWDOSTIP"/><ref name="Kotulla_1987_Environment"/> While the variable is undefined by default under DOS Plus and DR-DOS, the Multiuser DOS default for an ASCII terminal equals <code>SET $OFF=\033q</code>.<ref name="Paul_2002_CLS"/><ref name="CCI_1997_HELP"/> See also the related environment variable <code>%$ON%</code>.

;{{anchor|%$HEADER%}}<code>%$HEADER%</code>: This variable can hold an optional control sequence issued before the output of the file contents in commands like <code>TYPE</code> under DR-DOS 7.02 and higher. It can be used for highlighting, pagination or formatting, f.e. when sending the output to a printer, i.e. <code>SET $HEADER=\017</code> for an IBM or ESC/P printer. For the special <code>\nnn</code> octal notation supported, see <code>%$CLS%</code>.<ref name="Paul_2002_CLS"/> See also the related environment variable <code>%$FOOTER%</code>.

;{{anchor|%$FOOTER%}}<code>%$FOOTER%</code>: This variable can hold an optional control sequence issued after the output of the file contents in commands like <code>TYPE</code> under DR-DOS 7.02 and higher. It is used to return to the normal output format, i.e. <code>SET $FOOTER=\022\014</code> in the printer example above. For the special <code>\nnn</code> octal notation supported, see <code>%$CLS%</code>.<ref name="Paul_2002_CLS"/> See also the related environment variable <code>%$HEADER%</code>.

Datalight ROM-DOS supports a number of additional ''standard environment variables'' as well including:

;{{anchor|%DIRSIZE%}}<code>%DIRSIZE%</code>: This variable is used to define non-standard screen sizes <code>rows[,cols]</code> for <code>DIR</code> options <code>/P</code> and <code>/W</code> (similar to <code>%$LENGTH%</code> and <code>%$WIDTH%</code> under DOS Plus).<ref name="Datalight_2005_ROM-DOS"/>

;{{anchor|%NEWFILE%}}<code>%NEWFILE%</code>: This variable is automatically set to the first parameter given to the CONFIG.SYS directive NEWFILE.<ref name="Datalight_2005_ROM-DOS"/>

{{anchor|%TZ%|%COMM%|%SOCKETS%|%HTTP_DIR%|%HOSTNAME%|%FTPDIR%}}<code>%TZ%</code>, <code>%COMM%</code>, <code>%SOCKETS%</code>, <code>%HTTP_DIR%</code>, <code>%HOSTNAME%</code> and <code>%FTPDIR%</code> are also used by ROM-DOS.<ref name="Datalight_2005_ROM-DOS"/>

==={{anchor|OS/2-ENV}}OS/2 ===

;{{anchor|BEGINLIBPATH}}<code>%BEGINLIBPATH%</code>: Contains a semicolon-separated list of directories which are searched for DLLs ''before'' the directories given by the <code>%LIBPATH%</code> variable (which is set during system startup with the special CONFIG.SYS directive <code>LIBPATH</code>). It is possible to specify relative directories here, including "<code>.</code>" for the current working directory. See also the related environment variable <code>%ENDLIBPATH%</code>.

;{{anchor|ENDLIBPATH}}<code>%ENDLIBPATH%</code>: a list of directories to be searched for DLLs like <code>%BEGINLIBPATH%</code>, but searched ''after'' the list of directories in <code>%LIBPATH%</code>.

==={{anchor|WIN-ENV}}Windows === These environment variables refer to locations of critical operating system resources, and as such generally are not user-dependent.<ref>{{cite web | url=https://learn.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables | title=Recognized environment variables - Windows Deployment | date=9 January 2024 }}</ref>

;{{anchor|APPDATA}}<code>%APPDATA%</code><!-- all-uppercase at least under XP -->: Contains the full path to the ''Application Data'' directory of the logged-in user. Does not work on Windows NT 4.0 SP6 UK.

;{{anchor|LOCALAPPDATA}}<code>%LOCALAPPDATA%</code>: This variable is the local data files of ''Applications''. Its uses include storing of desktop themes, Windows error reporting, caching and profiles of web browsers.

;{{anchor|ComSpec|COMSPEC}}<code>%ComSpec%</code><!-- mixed case for CMD under XP -->/<code>%COMSPEC%</code>:The <code>%ComSpec%</code> variable contains the full path to the command processor; on the Windows NT family of operating systems, this is cmd.exe, while on Windows 9x, <code>%COMSPEC%</code> is COMMAND.COM.

;{{anchor|OS}}<code>%OS%</code>:The <code>%OS%</code> variable contains a symbolic name of the operating system family to distinguish between differing feature sets in batchjobs. It resembles an identically named environment variable <code>%OS%</code> found in all DOS-related operating systems of Digital Research-origin like Concurrent DOS, Multiuser DOS, REAL/32, DOS Plus, DR DOS, Novell DOS and OpenDOS. <code>%OS%</code> always holds the string "<code>Windows_NT</code>" on the Windows NT family.<ref name="Ten_XP"/>

;{{anchor|Path|PATH}}<code>%PATH%</code><!-- all-uppercase at least under XP -->: This variable contains a semicolon-delimited (do not put spaces in between) list of directories in which the command interpreter will search for an executable file that matches the given command. Environment variables that represent paths may be nested within the <code>%PATH%</code> variable, but only at one level of indirection. If this sub-path environment variable itself contains an environment variable representing a path, <code>%PATH%</code> will not expand properly in the variable substitution. Equivalent to the Unix <code>$PATH</code> variable.

;{{anchor|PROCESSOR_ARCHITECTURE|PROCESSOR_ARCHITEW6432|PROCESSOR_IDENTIFIER|PROCESSOR_LEVEL|PROCESSOR_REVISION}}<code>%PROCESSOR_ARCHITECTURE%</code>, <code>%PROCESSOR_ARCHITEW6432%</code>, <code>%PROCESSOR_IDENTIFIER%</code>, <code>%PROCESSOR_LEVEL%</code>, <code>%PROCESSOR_REVISION%</code>: These variables contain details of the CPU; they are set during system installation.

;{{anchor|PUBLIC}}<code>%PUBLIC%</code>: The <code>%PUBLIC%</code> variable (introduced with Vista) points to the ''Public'' (pseudo) user profile directory "<code>C:\Users\Public</code>".

;{{anchor|ProgramFiles|ProgramFiles(x86)|ProgramW6432}}<code>%ProgramFiles%</code>, <code>%ProgramFiles(x86)%</code>, <code>%ProgramW6432%</code>: The <code>%ProgramFiles%</code> variable points to the ''Program Files'' directory, which stores all the installed programs of Windows and others. The default on English-language systems is "<code>C:\Program Files</code>". In 64-bit editions of Windows (XP, 2003, Vista), there are also <code>%ProgramFiles(x86)%</code>, which defaults to "<code>C:\Program Files (x86)</code>", and <code>%ProgramW6432%</code>, which defaults to "<code>C:\Program Files</code>". The <code>%ProgramFiles%</code> itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit (this is caused by Windows-on-Windows 64-bit redirection<ref>{{cite web | url=https://msdn.microsoft.com/en-us/library/aa384274.aspx#environment-variables | title=WOW64 Implementation Details }}</ref>).

;{{anchor|CommonProgramFiles|CommonProgramFiles(x86)|CommonProgramW6432}}<code>%CommonProgramFiles%</code>, <code>%CommonProgramFiles(x86)%</code>, <code>%CommonProgramW6432%</code>: This variable points to the ''Common Files'' subdirectory of the ''Program Files'' directory. The default on English-language systems is "<code>C:\Program Files\Common Files</code>". In 64-bit editions of Windows (XP, 2003, Vista), there are also <code>%ProgramFiles(x86)%</code>, which defaults to "<code>C:\Program Files (x86)</code>", and <code>%ProgramW6432%</code>, which defaults to "<code>C:\Program Files</code>". The <code>%ProgramFiles%</code> itself depends on whether the process requesting the environment variable is itself 32-bit or 64-bit (this is caused by Windows-on-Windows 64-bit redirection).

;{{anchor|SystemDrive}}<code>%OneDrive%</code>: The <code>%OneDrive%</code> variable is a special system-wide environment variable found on Windows NT and its derivatives. Its value is the path of where (if installed and setup) the Onedrive directory is located. The value of <code>%OneDrive%</code> is in most cases "<code>C:\Users\{Username}\OneDrive\</code>".

;{{anchor|SystemDrive}}<code>%SystemDrive%</code>: The <code>%SystemDrive%</code> variable is a special system-wide environment variable found on Windows NT and its derivatives. Its value is the drive upon which the system directory was placed. The value of <code>%SystemDrive%</code> is in most cases "<code>C:</code>".

;{{anchor|SystemRoot}}<code>%SystemRoot%</code>:The <code>%SystemRoot%</code> variable is a special system-wide environment variable found on the Windows NT family of operating systems. Its value is the location of the system directory, including the drive and path. The drive is the same as <code>%SystemDrive%</code> and the default path on a clean installation depends upon the version of the operating system. By default: :* Windows XP and newer versions use "<code>\WINDOWS</code>". :* Windows 2000, NT 4.0 and NT 3.1 use "<code>\WINNT</code>". :* Windows NT 3.5 and NT 3.51 uses "<code>\WINNT35</code>". :* Windows NT 4.0 Terminal Server uses "<code>\WTSRV</code>".

;{{anchor|windir}}<code>%windir%</code><!-- all-lowercase at least under Windows 95–98/98SE and Windows XP -->:This variable points to the ''Windows'' directory. (On the Windows NT family of operating systems, it is identical to the <code>%SystemRoot%</code> variable). Windows 9598 and Windows ME are, by default, installed in "<code>C:\Windows</code>". For other versions of Windows, see the <code>%SystemRoot%</code> entry above.

''User management variables''{{citation needed|date=August 2014|reason=Is this an official name used in Microsoft literature? If not, we should not italicize it and use the official name instead.}} 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.

;{{anchor|ALLUSERSPROFILE|PROGRAMDATA}}<code>%ALLUSERSPROFILE%</code><!-- all-uppercase at least under XP --> (<code>%PROGRAMDATA%</code> since Windows Vista): This 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'' directories will appear in every user's ''Start menu'' or ''Desktop'', respectively.

;{{anchor|USERDOMAIN}}<code>%USERDOMAIN%</code><!-- all-uppercase at least under XP -->: The name of the ''Workgroup'' or ''Windows Domain'' to which the current user belongs. The related variable, <code>%LOGONSERVER%</code>, holds the hostname of the server that authenticated the current user's login 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).

;{{anchor|USERPROFILE}}<code>%USERPROFILE%</code><!-- all-uppercase at least under XP -->: A special system-wide environment variable found on 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 (<code>NTUSER</code>). Users can also use the <code>%USERNAME%</code> variable to determine the active users login identification.

''Optional System variables''{{citation needed|date=August 2014|reason=Is this an official name used in Microsoft literature? If not, we should not italicize it and use the official name instead.}} are not explicitly specified by default but can be used to modify the default behavior of certain built-in console commands. These variables also do not need to be explicitly specified as command line arguments.

==== Default values ==== The following tables shows typical default values of certain environment variables under English versions of Windows as they can be retrieved under <code>CMD</code>.

(Some of these variables are also defined when running <code>COMMAND.COM</code> under Windows, but differ in certain important details: Under <code>COMMAND.COM</code>, the names of environment variable are always uppercased. Some, but not all variables contain short 8.3 rather than long file names. While some variables present in the <code>CMD</code> environment are missing, there are also some variables specific to the <code>COMMAND</code> environment.) {| class="wikitable" |- ! Variable ! Locale specific ! Windows XP (CMD) ! Windows Vista and later (CMD) |- | {{mono|%ALLUSERSPROFILE%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|C:\Documents and Settings\All Users}} | {{mono|C:\ProgramData}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%APPDATA%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|C:\Documents and Settings\%USERNAME%\Application Data}} | {{mono|C:\Users\%USERNAME%\AppData\Roaming}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%CommonProgramFiles%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|C:\Program Files\Common Files}} | {{mono|C:\Program Files\Common Files}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%CommonProgramFiles(x86)%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|C:\Program Files (x86)\Common Files}} ''(only in 64-bit version)'' | {{mono|C:\Program Files (x86)\Common Files}} ''(only in 64-bit version)''<ref name="Schulz_2014_Ordner"/> |- | {{mono|%CommonProgramW6432%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%CommonProgramW6432%}} ''(not supported, not replaced by any value)'' | {{mono|C:\Program Files\Common Files}} ''(only in 64-bit version)''<ref name="Schulz_2014_Ordner"/> |- | {{mono|%COMPUTERNAME%}} | {{No}} | {computername} | {computername} |- | {{mono|%ComSpec%}} | {{No}} | {{mono|C:\Windows\System32\cmd.exe}} | {{mono|C:\Windows\System32\cmd.exe}} |- {{anchor|%HOMEDRIVE%}} | {{mono|%HOMEDRIVE%}}<ref name="Schulz_2014_Ordner"/> | {{No}} | C: | C:<ref name="Schulz_2014_Ordner"/> |- {{anchor|%HOMEPATH%}} | {{mono|%HOMEPATH%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|\Documents and Settings\%USERNAME%}} | {{mono|\Users\%USERNAME%}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%LOCALAPPDATA%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%LOCALAPPDATA%}} ''(not supported, not replaced by any value)'' | {{mono|C:\Users\%USERNAME%\AppData\Local}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%LOGONSERVER%}} | {{No}} | {{mono|\\{domain_logon_server} }} | {{mono|\\{domain_logon_server} }} |- | {{mono|%PATH%}} | {{Yes}} | {{mono|C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} }} | {{mono|C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;{plus program paths} }} |- | {{mono|%PATHEXT%}} | {{No}} | .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.WSF;.WSH | .com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh;.msc |- | {{mono|%ProgramData%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%ProgramData%}} ''(not supported, not replaced by any value)'' | {{mono|%SystemDrive%\ProgramData}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%ProgramFiles%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%SystemDrive%\Program Files}} | {{mono|%SystemDrive%\Program Files}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%ProgramFiles(x86)%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%SystemDrive%\Program Files (x86)}} ''(only in 64-bit version)'' | {{mono|%SystemDrive%\Program Files (x86)}} ''(only in 64-bit version)''<ref name="Schulz_2014_Ordner"/> |- | {{mono|%ProgramW6432%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%ProgramW6432%}} ''(not supported, not replaced by any value)'' | {{mono|%SystemDrive%\Program Files}} ''(only in 64-bit version)''<ref name="Schulz_2014_Ordner"/> |- | {{mono|%PROMPT%}} | {{No}} | Code for current command prompt format, usually {{code|$P$G}} | Code for current command prompt format, usually {{code|$P$G}} |- | {{mono|%PSModulePath%}} | | {{mono|%PSModulePath%}} ''(not supported, not replaced by any value)'' | {{mono|%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules\}} |- | {{mono|%PUBLIC%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%PUBLIC%}} ''(not supported, not replaced by any value)'' | {{mono|%SystemDrive%\Users\Public}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%SystemDrive%}}<ref name="Schulz_2014_Ordner"/> | {{No}} | C: | C:<ref name="Schulz_2014_Ordner"/> |- | {{mono|%SystemRoot%}}<ref name="Schulz_2014_Ordner"/> | {{No}} | The Windows directory, usually {{mono|C:\Windows}}, formerly {{mono|C:\WINNT}} | {{mono|%SystemDrive%\Windows}}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%TEMP%}}<ref name="Schulz_2014_Ordner"/> and {{mono|%TMP%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%SystemDrive%\Documents and Settings\%USERNAME%\Local Settings\Temp}} | {{mono|%SystemRoot%\TEMP}} (for system environment variables {{mono|%TMP%}} and {{mono|%TEMP%}}),<br/>{{mono|%USERPROFILE%\AppData\Local\Temp}}<ref name="Schulz_2014_Ordner"/> (for user environment variables {{mono|%TMP%}} and {{mono|%TEMP%}}) |- | {{mono|%USERDOMAIN%}} | {{No}} | {userdomain} | {userdomain} |- | {{mono|%USERNAME%}} | {{No}} | {USERNAME} | {USERNAME} |- | {{mono|%USERPROFILE%}}<ref name="Schulz_2014_Ordner"/> | {{Yes}} | {{mono|%SystemDrive%\Documents and Settings\%USERNAME% }} | {{mono|%SystemDrive%\Users\%USERNAME% }}<ref name="Schulz_2014_Ordner"/> |- | {{mono|%windir%}}<ref name="Schulz_2014_Ordner"/> | {{No}} | {{mono|%SystemDrive%\WINDOWS}} | {{mono|%SystemDrive%\Windows}}<ref name="Schulz_2014_Ordner"/> |}

In this list, there is no environment variable that refers to the location of the user's ''My Documents'' directory, so there is no standard method for setting a program's home directory to be the ''My Documents'' directory.

==Pseudo-environment variables== <!-- Section header used in redirects --> The command processors in DOS and Windows also support pseudo-environment variables. These are values that are fetched like environment variables, but are not truly stored in the environment but computed when requested.

==={{anchor|DOS-PSEUDOENV}}DOS === {{anchor|Replacement parameter|Replaceable parameter|Replacement variable|Batch file parameter}}Besides true environment variables, which are statically stored in the environment until changed or deleted, a number of pseudo-environment variables exist for batch processing.

The so-called ''replacement parameters'' or ''replaceable parameters'' (Microsoft / IBM terminology) aka ''replacement variables'' (Digital Research / Novell / Caldera terminology)<ref name="Caldera_1998_USER"/> or ''batch file parameters'' (JP Software terminology)<ref name="4DOS_8.00_HELP"/> <code>%1</code>..<code>%9</code> and <code>%0</code> can be used to retrieve the calling parameters of a batchjob, see <code>SHIFT</code>. In batchjobs, they can be retrieved just like environment variables, but are not actually stored in the environment.

{{anchor|System information variable|Internal variable}} Some command-line processors (like DR-DOS <code>COMMAND.COM</code>,<ref name="Caldera_1998_USER"/> Multiuser DOS <code>MDOS.COM</code>/<code>TMP.EXE</code> (Terminal Message Process), JP Software 4DOS, 4OS2, Take Command (formerly 4NT) and Windows cmd.exe) support a type of pseudo-environment variables named ''system information variables'' (Novell / Caldera terminology)<ref name="Caldera_1998_USER"/> or ''internal variables'' (JP Software terminology),<ref name="4DOS_8.00_HELP"/> which can be used to retrieve various possibly dynamic, but read-only information about the running system in batch jobs. The returned values represent the status of the system in the moment these variables are queried; that is, reading them multiple times in a row may return different values even within the same command; querying them has no direct effect on the system. Since they are not stored in the environment, they are not listed by SET and do not exist for external programs to retrieve. If a true environment variable of the same name is defined, it takes precedence over the corresponding variable until the environment variable is deleted again. They are not case-sensitive. While almost all such variables are prefixed with an underscore ("<code>_</code>") by 4DOS etc. by convention (f.e. <code>%_SECOND%</code>),<ref name="4DOS_8.00_HELP"/> they are not under DR-DOS <code>COMMAND.COM</code> (f.e. <code>%OS_VERSION%</code>).

{{anchor|Variable function}}In addition, 4DOS, 4OS2, 4NT, and Take Command also support so called ''variable functions'',<ref name="4DOS_8.00_HELP"/> including user-definable ones. They work just like ''internal variables'', but can take optional parameters (f.e. <code>%@EVAL[]%</code>) and may even change the system status depending on their function.

''System information variables'' supported by DR-DOS <code>COMMAND.COM</code>:

;{{anchor|%AM_PM%}}<code>%AM_PM%</code>: This pseudo-variable returns the ante- or post-midday status of the current time. The returned string depends on the locale-specific version of DR-DOS, f.e. "<code>am</code>" or "<code>pm</code>" in the English version. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%DAY%|DAY%}}<!-- DAY% just to work-around a parsing problem with the link found in the %_DAY% entry below --><code>%DAY%</code>: This pseudo-variable returns the days of the current date in a 2-digit format with leading zeros, f.e. "<code>01</code>".."<code>31</code>". See also the similar pseudo-variable <code>%_DAY%</code>. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%DAY_OF_WEEK%}}<code>%DAY_OF_WEEK%</code>: This pseudo-variable returns the day name of the week in a 3-character format. The returned string depends on the locale-specific version of DR-DOS, f.e. "<code>Sun</code>", "<code>Mon</code>", "<code>Tue</code>", "<code>Wed</code>", "<code>Thu</code>", "<code>Fri</code>", or "<code>Sat</code>" in the English version. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%ERRORLEVEL%}}<code>%ERRORLEVEL%</code>: In <code>COMMAND.COM</code> of DR-DOS 7.02 and higher, this pseudo-variable returns the last error level returned by an external program or the <code>RETURN</code> command, f.e. "<code>0</code>".."<code>255</code>".<ref name="Paul_1997_BATTIPS"/><ref name="FD_2003_Errorlevel"/> See also the identically named pseudo-variable <code>%ERRORLEVEL%</code> under Windows and the <code>IF ERRORLEVEL</code> conditional command.

;{{anchor|%ERRORLVL%}}<code>%ERRORLVL%</code>: In DR-DOS 7.02 and higher, this pseudo-variable returns the last error level in a 3-digit format with leading zeros, f.e. "<code>000</code>".."<code>255</code>".<ref name="Paul_1997_BATTIPS"/><ref name="FD_2003_Errorlevel"/> Under Multiuser DOS, this is a true environment variable automatically updated by the shell to the return code of exiting programs.<ref name="CCI_1997_HELP"/> See also the related pseudo-variable <code>%ERRORLEVEL%</code> under DR-DOS and the <code>IF ERRORLEVEL</code> command.

;{{anchor|%GREETING_TIME%}}<code>%GREETING_TIME%</code>: This pseudo-variable returns the 3-level day greeting time. The returned string depends on the locale-specific version of DR-DOS, f.e. "<code>morning</code>", "<code>afternoon</code>", or "<code>evening</code>" in the English version. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%HOUR%}}<code>%HOUR%</code>: This pseudo-variable returns the hours of the current time in 12-hour format without leading zeros, f.e. "<code>1</code>".."<code>12</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%HOUR24%}}<code>%HOUR24%</code>: This pseudo-variable returns the hours of the current time in 24-hour format in a 2-digit format with leading zeros, f.e. "<code>00</code>".."<code>23</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts. See also the similar pseudo-variable <code>%_HOUR%</code>.

;{{anchor|%MINUTE%}}<code>%MINUTE%</code>: This pseudo-variable returns the minutes of the current time in a 2-digit format with leading zeros, f.e "<code>00</code>".."<code>59</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts. See also the similar pseudo-variable <code>%_MINUTE%</code>.

;{{anchor|%MONTH%}}<code>%MONTH%</code>: This pseudo-variable returns the months of the current date in a 2-digit format with leading zeros, f.e. "<code>01</code>".."<code>12</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts. See also the similar pseudo-variable <code>%_MONTH%</code>.

;{{anchor|%MONTH_NAME%}}<code>%MONTH_NAME%</code>: This pseudo-variable returns the month name of the current date. The returned string depends on the locale-specific version of DR-DOS, f.e. "<code>January</code>", "<code>February</code>", "<code>March</code>", "<code>April</code>", "<code>May</code>", "<code>June</code>", "<code>July</code>", "<code>August</code>", "<code>September</code>", "<code>October</code>", or "<code>December</code>" in the English version. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%NDAY_OF_WEEK%}}<code>%NDAY_OF_WEEK%</code>: This pseudo-variable returns the number of day of the current week, f.e. "<code>1</code>".."<code>7</code>" (with "<code>1</code>" for Sunday). It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%OS_VERSION%}}<code>%OS_VERSION%</code>: This pseudo-variable returns the version of the operating system depending on the current setting of the environment variable <code>%VER%</code>. If <code>%VER%</code> is not defined, <code>%OS_VERSION%</code> returns "<code>off</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts, which may return versions also for non-DR-DOS versions of DOS.

;{{anchor|%SECOND%}}<code>%SECOND%</code>: This pseudo-variable returns the seconds of the current time in a 2-digit format with leading zeros, f.e. "<code>00</code>".."<code>59</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts. See also the similar pseudo-variable <code>%_SECOND%</code>.

;{{anchor|%SHORT_YEAR%}}<code>%SHORT_YEAR%</code>: This pseudo-variable returns the year of the current date in a 2-digit format with leading zeros, f.e. "<code>93</code>".."<code>99</code>", "<code>00</code>".."<code>92</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%YEAR%|%_YEAR%}}<code>%YEAR%</code> and <code>%_YEAR%</code>: Supported since Novell DOS 7, the <code>%YEAR%</code> pseudo-variable returns the year of the current date in a 4-digit format, f.e. "<code>1980</code>".."<code>2099</code>". It resembles an identically named ''identifier variable'' in Novell NetWare login scripts. DR-DOS 7.02 and higher added <code>%_YEAR%</code> for compatibility with 4DOS, returning the same value.<ref name="4DOS_8.00_HELP"/>

;{{anchor|%/%}}<code>%/%</code>: In <code>COMMAND.COM</code> of DR-DOS 7.02 and higher, this pseudo-variable returns the current SwitChar setting of the system, either "<code>/</code>" (DOS style) or "<code>-</code>" (Unix style)<!-- "[" not officially supported by %/% -->.<ref name="Caldera_1998_DELTREE101"/><ref name="Caldera_1998_NEW703"/> See also the related <code>CONFIG.SYS</code> directive SWITCHAR and the environment variable <code>%SWITCHAR%</code>.

;{{anchor|%_CODEPAGE%}}<code>%_CODEPAGE%</code>: This pseudo-variable returns the systems' current code page ("<code>1</code>".."<code>65533</code>"<!-- 0, 65534 and 65535 are reserved values -->), f.e. "<code>437</code>", "<code>850</code>", "<code>858</code>". This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the <code>CHCP</code> command.

;{{anchor|%_COLUMNS%}}<code>%_COLUMNS%</code>: This pseudo-variable returns the current number of screen columns depending on the display mode, f.e. "<code>40</code>", "<code>80</code>", "<code>132</code>", etc. This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also a similar environment variable <code>%$WIDTH%</code> under DOS Plus.

;{{anchor|%_COUNTRY%}}<code>%_COUNTRY%</code>: This pseudo-variable returns the systems' current country code ("<code>1</code>".."<code>65534</code>"<!-- 0 and 65535 are reserved values -->), f.e. "<code>1</code>" for USA, "<code>44</code>" for UK, "<code>49</code>" for Germany, "<code>20049</code>" with ISO 8601, "<code>21049</code>"<!-- with Euro support and <code>22049</code>" --> with ISO 8601 and Euro support.<ref name="Caldera_1998_NEW703"/><ref name="Paul_2001_COUNTRY"/> This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the <code>CONFIG.SYS</code> directive <code>COUNTRY</code>.

;{{anchor|%_DAY%}}<code>%_DAY%</code>: This pseudo-variable returns the days of the current date without leading zeros, f.e. "<code>1</code>".."<code>31</code>". This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the similar pseudo-variable <code><!-- DAY% (instead of the correct %DAY% just to work-around a parsing problem with the link -->%DAY%</code>.

;{{anchor|%_HOUR%}}<code>%_HOUR%</code>: This pseudo-variable returns the hours of the current time in 24-hour format without leading zeros, f.e. "<code>0</code>".."<code>23</code>". This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the similar pseudo-variable <code>%HOUR24%</code>.

;{{anchor|%_MINUTE%}}<code>%_MINUTE%</code>: This pseudo-variable returns the minutes of the current time without leading zeros, f.e "<code>0</code>".."<code>59</code>". This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the similar pseudo-variable <code>%MINUTE%</code>.

;{{anchor|%_MONTH%}}<code>%_MONTH%</code>: This pseudo-variable returns the months of the current date without leading zeros, f.e. "<code>1</code>".."<code>12</code>". This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the similar pseudo-variable <code>%MONTH%</code>.

;{{anchor|%_ROWS%}}<code>%_ROWS%</code>: This pseudo-variable returns the current number of screen rows depending on the display mode, f.e. "<code>25</code>", "<code>43</code>", "<code>50</code>", etc. This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See a similar environment variable <code>%$LENGTH%</code> under DOS Plus.

;{{anchor|%_SECOND%}}<code>%_SECOND%</code>: This pseudo-variable returns the seconds of the current time without leading zeros, f.e. "<code>0</code>".."<code>59</code>". This variable was originally introduced by 4DOS,<ref name="4DOS_8.00_HELP"/> but also became available with <code>COMMAND.COM</code> since DR-DOS 7.02. See also the similar pseudo-variable <code>%SECOND%</code>.

''System information variables'' supported by DR-DOS <code>COMMAND.COM</code> with networking loaded:

;{{anchor|%LOGIN_NAME%}}<code>%LOGIN_NAME%</code>: This pseudo-variable returns the user name. This always worked with <code>NETX</code>, but it will also work with Personal NetWare's ODI/VLM<!-- since Novell DOS 7 Update 14 --> if the current drive is a PNW-mapped drive (otherwise an empty string is returned). See also the similarly named environment variable <code>%LOGINNAME%</code>.

;{{anchor|%P_STATION%}}<code>%P_STATION%</code>: This pseudo-variable returns the physical station number in a format "<code>????????????</code>". The value depends on the MAC address of the network adapter, but can be overridden. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%STATION%}}<code>%STATION%</code>: This pseudo-variable returns the logical station number starting with "<code>1</code>" for the first client. The numbers are assigned by the file server and remain static for as long as the IPX connection remains established. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts.

;{{anchor|%FULL_NAME%}}<code>%FULL_NAME%</code>: This pseudo-variable returns the full name of the logged in user, if available. It resembles an identically named ''identifier variable'' in Novell NetWare login scripts. See also the related pseudo-variable <code>%LOGIN_NAME%</code>.

==={{anchor|WIN-PSEUDOENV}}Windows === ''Dynamic environment variables'' (also named ''internal variables'' or ''system information variables'' under DOS) are pseudo-environment variables supported by <code>CMD.EXE</code> when command-line extensions are enabled, and they expand to various discrete values whenever queried, that is, their values can change when queried multiple times even within the same command. While they can be used in batch jobs and at the prompt, they are not stored in the environment. Consequently, they are neither listed by <code>SET</code> nor do they exist for external programs to read. They are not case-sensitive.

Indirectly, they are also supported under Windows' <code>COMMAND.COM</code>, which has been modified to internally call <code>CMD.EXE</code> to execute the commands.<!-- see ECHO %CMDCMDLINE% under COMMAND.COM -->

;{{anchor|CD}}<code>%CD%</code>: This pseudo-variable expands to the current directory equivalent to the output of the command <code>CD</code> when called without arguments. While a long filename can be returned under <code>CMD.EXE</code> depending on the current directory, the fact that the current directory will always be in 8.3 format under <code>COMMAND.COM</code> will cause it to return a short filename under <code>COMMAND.COM</code>, even when <code>COMMAND</code> internally calls <code>CMD</code>.

;{{anchor|CMDCMDLINE}}<code>%CMDCMDLINE%</code>: This pseudo-variable expands to the original startup parameters of <code>CMD.EXE</code>, f.e. "<code>C:\Windows\system32\cmd.exe</code>". Under Windows' <code>COMMAND.COM</code>, this may return something like "<code>C:\Windows\system32\cmd.exe /c ...</code>" due to the fact that <code>COMMAND.COM</code> calls <code>CMD.EXE</code> internally.

;{{anchor|CMDEXTVERSION}}<code>%CMDEXTVERSION%</code>: This pseudo-variable expands to the version of the command-line extensions of <code>CMD.EXE</code>, if enabled (e.g. "<code>1</code>" under Windows NT, "<code>2</code>" under Windows 2000 and Windows XP).

;{{anchor|DATE}}<code>%DATE%</code>: This pseudo-variable expands to the current date. The date is displayed according to the current user's date format preferences.

;{{anchor|ERRORLEVEL}}<code>%ERRORLEVEL%</code>: This pseudo-variable expands to the last set error level, a value between "<code>0</code>" and "<code>255</code>" (without leading zeros).<ref name="Paul_1997_BATTIPS"/><ref name="Allen_2005"/><ref name="FD_2003_Errorlevel"/> External commands and some internal commands set error levels upon execution. See also the identically named pseudo-variable <code>%ERRORLEVEL%</code> under DR-DOS and the <code>IF ERRORLEVEL</code> command.

;{{anchor|HIGHESTNUMANODENUMBER}}<code>%HIGHESTNUMANODENUMBER%</code>: This pseudo-variable returns the number of the highest NUMA node.

;{{anchor|RANDOM}}<code>%RANDOM%</code>: This pseudo-variable returns a random number between "<code>0</code>" and "<code>32767</code>".

;{{anchor|TIME}}<code>%TIME%</code>: This pseudo-variable returns the current time. The time is displayed according to the current user's time format preferences. If the <code>%TIME%</code> and <code>%DATE%</code> variables are both used, it is important to read them both in this particular order in rapid succession in order to avoid midnight-rollover problems.

===Other shells=== Unix-like shells have similar dynamically generated variables, bash's <code>$RANDOM</code> being a well-known example. However, since these shells have a concept of local variables, they are described as special local variables instead.<ref name="GNU_BASH"/>

== See also == * Variable (computer science) * List of POSIX commands * List of DOS commands * Special folder * Environment Modules * PWB shell * Windows Registry

== Notes == {{Reflist|group="nb"|refs= <ref group="nb" name="NB_CMDLINE">4DOS and MS-DOS 7.0 set the length to 127 and insert ASCII-13 at this position, but Borland libraries set the length to the invalid value of 128 and do not insert an ASCII-13. For shorter command lines, 4DOS/NDOS and DR-DOS also insert an ASCII-0 after the ASCII-13, but not when invoked via INSTALL directive; MS-DOS does not.</ref> <ref group="nb" name="NB_ENVLEN128">Applications not coping properly with environment variables longer than 128 characters include CadStar PCB, Checkit, Computer Select CD-ROM, RenderMan, VINES Network, Windows 3.0, and Word for Windows 6.0.</ref> }}

== References == {{Reflist|refs= <ref name="ClassicShS">{{cite book |title=Classic Shell Scripting |publisher=O'Reilly |isbn=978-0-596-00595-5 |date=May 2005 |author-first1=Arnold |author-last1=Robbins |author-first2=Nelson H. F. |author-last2=Beebe |editor-last1=Apandi |editor-first1=Tatiana |editor-last2=Randal |editor-first2=Allison |editor-last3=Witwer |editor-first3=Adam |edition=1}}</ref>{{rp|112}} <ref name="OG_unset">{{cite web |title=unset - unset values and attributes of variables and functions{{snd}} |work=Commands & Utilities Reference, The Single UNIX Specification - The Open Group Base Specifications, IEEE Std 1003.1-2008 |date=2016 |orig-date=2001 |edition=Issue 7 |issue=7 |publisher=The IEEE and The Open Group |url=https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#unset |access-date=2017-12-18 |url-status=live |archive-url=https://web.archive.org/web/20171218175244/http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html |archive-date=2017-12-18}}</ref> <ref name="Bash_unset">{{cite web |title=The unset builtin command |date=2015-07-31 |orig-date=2011 |author=fgrose |work=Bash Hackers Wiki |url=http://wiki.bash-hackers.org/commands/builtin/unset |access-date=2017-12-18 |url-status=live |archive-url=https://web.archive.org/web/20171218175214/http://wiki.bash-hackers.org/commands/builtin/unset |archive-date=2017-12-18}}</ref> <ref name="appdata">{{cite web |title=Store and retrieve settings and other app data |date=2017-11-14 |author-first1=Mike |author-last1=Jacobs |author-first2=Alexander |author-last2=Koren |author-first3=Michael |author-last3=Satran |publisher=Microsoft |url=https://docs.microsoft.com/en-us/windows/uwp/app-settings/store-and-retrieve-app-data |access-date=2017-12-18 |url-status=live |archive-url=https://web.archive.org/web/20171218175200/https://docs.microsoft.com/de-de/windows/uwp/design/app-settings/store-and-retrieve-app-data |archive-date=2017-12-18}}</ref> <ref name="Schulz_2014_Ordner">{{cite journal |title=Ordner für spezielle Fälle&nbsp;— Die "benannten Ordner" in Windows aus User- und Entwicklersicht |trans-title=Special purpose folders&nbsp;— Windows' "named folders" from a user's and developer's perspective |author-first=Hajo |author-last=Schulz |date=2014-10-02 |journal=c't - magazin für computertechnik |volume=2014 |issue=22 |pages=180–184 |publisher=Heise Verlag |language=de |url=https://www.heise.de/ct/ausgabe/2014-22-Die-benannten-Ordner-in-Windows-aus-User-und-Entwicklersicht-2406251.html |access-date=2019-04-08 |url-status=live |archive-url=https://web.archive.org/web/20160709114401/https://www.heise.de/ct/ausgabe/2014-22-Die-benannten-Ordner-in-Windows-aus-User-und-Entwicklersicht-2406251.html |archive-date=2016-07-09}}</ref> <ref name="Caldera_1998_USER">{{cite book |title=Caldera DR-DOS 7.02 User Guide |publisher=Caldera, Inc. |date=1998 |orig-date=1993, 1997 |url=http://www.drdos.net/documentation/usergeng/uglontoc.htm |access-date=2013-08-10 |url-status=dead |archive-url=https://web.archive.org/web/20161104235434/http://www.drdos.net/documentation/usergeng/uglontoc.htm |archive-date=2016-11-04}}</ref> <ref name="Caldera_1998_NEW703">{{cite book |title=DR-DOS 7.03 WHATSNEW.TXT&nbsp;— Changes from DR-DOS 7.02 to DR-DOS 7.03 |publisher=Caldera, Inc. |date=1998-12-24 |url=http://www.lookas.net/ftp/incoming/darbui/Justas/DRDOS/WHATSNEW.TXT |access-date=2019-04-08 |url-status=dead |archive-url=https://web.archive.org/web/20190408142232/http://www.lookas.net/ftp/incoming/darbui/Justas/DRDOS/WHATSNEW.TXT |archive-date=2019-04-08}}</ref> <ref name="Caldera_1998_DELTREE101">{{cite book |title=DELTREE.BAT R1.01 Extended file and directory delete |author-first=Matthias R. |author-last=Paul |publisher=Caldera, Inc. |date=1998-01-09 |url=http://www.lookas.net/ftp/incoming/darbui/Justas/DRDOS/DELTREE.BAT |access-date=2019-04-08 |url-status=dead |archive-url=https://web.archive.org/web/20190408145354/http://www.lookas.net/ftp/incoming/darbui/Justas/DRDOS/DELTREE.BAT |archive-date=8 April 2019 }}</ref> <ref name="4DOS_8.00_HELP">{{cite book |title=4DOS 8.00 online help |title-link=4DOS 8.00 |author-first1=Hardin |author-last1=Brothers |author-first2=Tom |author-last2=Rawson |author-link2=Tom Rawson |author-first3=Rex C. |author-last3=Conn |author-link3=Rex C. Conn |author-first4=Matthias R. |author-last4=Paul |author-first5=Charles E. |author-last5=Dye |author-first6=Luchezar I. |author-last6=Georgiev |date=2002-02-27}}</ref> <ref name="Paul_1997_NWDOSTIP">{{cite book |title=NWDOS-TIPs&nbsp;— Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds |work=MPDOSTIP |author-first=Matthias R. |author-last=Paul |date=1997-07-30 |orig-date=1994-05-01 |edition=3 |version=Release 157 |language=de |url=http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm |access-date=2014-08-06 |url-status=live |archive-url=https://web.archive.org/web/20161104235829/http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm |archive-date=2016-11-04}} (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. The provided link points to a HTML-converted version of the file, which is part of the <code>MPDOSTIP.ZIP</code><!-- still named TIPS_MP.ZIP between 1991 and 1996-11 --> collection.) [https://web.archive.org/web/20190601152204/https://www.sac.sk/download/text/mpdostip.zip<!-- A yet older version 155 from 1997-05-13 of the 1997-07-15 distribution archive. -->]</ref> <ref name="Paul_2002_OS">{{cite web |title=How to detect FreeCOM/FreeDOS in-batch? |author-first=Matthias R. |author-last=Paul |date=2002-02-20 |url=http://marc.info/?l=freedos-dev&m=101423986407077&w=2 |publisher=freedos-dev mailing list |access-date=2014-08-06 |url-status=live |archive-url=https://web.archive.org/web/20181106220459/https://marc.info/?l=freedos-dev&m=101423986407077&w=2 |archive-date=2018-11-06}}</ref> <ref name="Paul_2002_CLS">{{cite web |title=Updated CLS posted |author-first=Matthias R. |author-last=Paul |date=2002-03-26 |url=http://marc.info/?l=freedos-dev&m=101717593306186&w=2 |publisher=freedos-dev mailing list |access-date=2014-08-06 |url-status=live |archive-url=https://web.archive.org/web/20181004145539/https://marc.info/?l=freedos-dev&m=101717593306186&w=2 |archive-date=2018-10-04}}</ref> <ref name="Paul_1997_OD-A3">{{cite web|author-first=Matthias R. |author-last=Paul |title=Caldera OpenDOS 7.01/7.02 Update Alpha 3 IBMBIO.COM README.TXT |url=http://www.uni-bonn.de/~uzs180/download/ibmbioa3.zip |date=1997-10-02 |access-date=2009-03-29 |url-status=dead |archive-url=https://web.archive.org/web/20031004074600/http://www-student.informatik.uni-bonn.de/~frinke/ibmbioa3.zip |archive-date=2003-10-04}} [https://web.archive.org/web/20181225154705/http://mirror.macintosharchive.org/max1zzz.co.uk/+Windows%20&%20DOS/DOS/System/Novell/Support/Bins/Op702src.zip<!-- Op702src.zip is an unofficial renamed distribution of the ibmbioa3.zip file -->]</ref> <ref name="Paul_1997_BATTIPS">{{cite book |title=BATTIPs&nbsp;— Tips & Tricks zur Programmierung von Batchjobs |at=7: ERRORLEVEL abfragen |work=MPDOSTIP |author-first=Matthias R. |author-last=Paul |date=1997-05-01 |orig-date=1993-10-01 |language=de |url=http://www.antonis.de/dos/batchtut/battips/index.htm#7 |access-date=2017-08-23 |url-status=live |archive-url=https://web.archive.org/web/20170823191411/http://www.antonis.de/dos/batchtut/battips/index.htm |archive-date=2017-08-23 }} [https://www.auersoft.eu/soft/by-others/dos-exitcodes-de.html] {{Webarchive|url=https://web.archive.org/web/20210423043703/https://www.auersoft.eu/soft/by-others/dos-exitcodes-de.html |date=2021-04-23 }} [https://www.auersoft.eu/soft/by-others/dos-exitcodes-en.html] {{Webarchive|url=https://archive.today/20170911103337/https://www.auersoft.eu/soft/by-others/dos-exitcodes-en.html |date=2017-09-11 }} (NB. BATTIPS.TXT is part of MPDOSTIP.ZIP. The provided link points to a HTML-converted older version of the BATTIPS.TXT file.) [https://web.archive.org/web/20190601152204/https://www.sac.sk/download/text/mpdostip.zip<!-- A yet older version 155 from 1997-05-13 of the 1997-07-15 distribution archive. -->]</ref> <ref name="Allen_2005">{{cite web |author-first1=William |author-last1=Allen |author-first2=Linda |author-last2=Allen |title=Windows 95/98/ME ERRORLEVELs |url=http://www.allenware.com/mcsw/errorlevels.zip |url-status=dead |archive-url=https://web.archive.org/web/20110707113138/http://www.allenware.com/mcsw/errorlevels.zip |archive-date=2011-07-07}}</ref> <ref name="FD_2003_Errorlevel">{{cite web |title=MS-DOS errorlevels |author-first1=Eric |author-last1=Auer |author-first2=Matthias R. |author-last2=Paul |author-first3=Jim |author-last3=Hall |author-link3=Jim Hall (programmer) |date=2015-12-24 |orig-date=2003-12-31 |url=http://www.freedos.org/technotes/technote/207.html |url-status=dead |archive-url=https://web.archive.org/web/20151224202118/http://www.freedos.org/technotes/technote/207.html |archive-date=2015-12-24}}</ref> <ref name="Paul_2017">{{cite web |title=The continuing saga of Windows 3.1 in enhanced mode on OmniBook 300 |author-first=Matthias R. |author-last=Paul |orig-date=2017-08-07 |date=2017-08-14 |work=MoHPC - the Museum of HP Calculators |url=https://hpmuseum.org/forum/thread-8774-post-77196.html#pid77196 |access-date=2018-05-01 |url-status=live |archive-url=https://web.archive.org/web/20180501185933/http://hpmuseum.org/forum/thread-8774-post-77196.html |archive-date=2018-05-01 |quote=[…] set DRSYS=ON (optional to tell SYS you are aware of the fact that you're running it in a foreign environment and want to proceed anyway without having to individually ACK some warnings and extra info screens displayed in this scenario otherwise) […]}}</ref> <ref name="Paul_1997_SETENV">{{cite web |title=SETENV v1.11 |author-first=Matthias R. |author-last=Paul |date=1997-05-27 |orig-date=1996 |url=http://www.uni-bonn.de:80/~uzs180/mpdokeng.html#M.SETENV |url-status=dead |archive-url=https://web.archive.org/web/20090215001349/http://www.uni-bonn.de/~uzs180/mpdokeng.html#M.SETENV |archive-date=2009-02-15 |quote=[…] SETENV […] to hide and later restore the […] pre-environment […] By using SETENV.COM you can save some KiloBytes of rare DOS memory […] depending on the number of drivers loaded by INSTALL=/INSTALLHIGH=/HIINSTALL= and the current size of the pre-environment. […] this original […] feature cannot be found in any known memory manager/optimizer. […] |access-date=2019-08-09}}</ref> <ref name="PTS-DOS_2000">{{cite web |title=PTS-DOS 2000 Pro User Manual |url=http://download.paragon-software.com/doc/manual_dos_eng.pdf |access-date=2018-05-12 |url-status=live |archive-url=https://web.archive.org/web/20180512094512/http://download.paragon-software.com/doc/manual_dos_eng.pdf |archive-date=2018-05-12}}</ref> <ref name="CCI_1997_HELP">{{cite book |title=CCI Multiuser DOS 7.22 GOLD Online Documentation |id=HELP.HLP |date=1997-02-10 |publisher=Concurrent Controls, Inc. (CCI)}}</ref> <ref name="CCI_1997_PRINTDOC">{{cite book |title=CCI Multiuser DOS 7.22 GOLD Installation Guide |id=PRINTDOC.HLP |date=1997-02-10 |publisher=Concurrent Controls, Inc. (CCI)}}</ref> <ref name="Kotulla_1987_Environment">{{cite journal |title=Von CP/M zu MS-DOS, Teil 11 |language=de |author-first=Martin |author-last=Kotulla |author-link=Martin Kotulla |journal=Professional Computing (PC) - Schneider International |volume=3 |issue=11 |date=November 1987 |pages=100–103 |url=http://www.homecomputerworld.at/magazine/cpc/CPCAI-87-11.pdf |access-date=2018-05-20 |url-status=live |archive-url=https://web.archive.org/web/20190424201007/http://www.homecomputerworld.at/magazine/cpc/CPCAI-87-11.pdf |archive-date=2019-04-24}}</ref> <ref name="Paul_2002_COM">{{cite newsgroup |title=Re: Run a COM file |author-first=Matthias R. |author-last=Paul |date=2002-10-07 |newsgroup=alt.msdos.programmer |url=https://groups.google.com/d/msg/alt.msdos.programmer/d7blJjY0H5M/Qu3VeTOIGVcJ |access-date=2017-09-03 |url-status=live |archive-url=https://archive.today/20170903230312/https://groups.google.com/forum/%23!msg/alt.msdos.programmer/d7blJjY0H5M/Qu3VeTOIGVcJ |archive-date=2017-09-03 }} [https://groups.google.com/d/msg/alt.lang.asm/PNOd9zfYow0/vXbab16j4XwJ] {{Webarchive|url=https://archive.today/20170903231100/https://groups.google.com/forum/%23!msg/alt.lang.asm/PNOd9zfYow0/vXbab16j4XwJ |date=2017-09-03 }}</ref> <ref name="Datalight_2005_ROM-DOS">{{cite web |title=Datalight ROM-DOS User's Guide |date=April 2005 |orig-date=1999 |id=3010-0200-0716 |author1=Datalight, Inc. |author-link1=Datalight, Inc. |author2=GPvNO |publisher=Datalight, Inc. |url=https://www.datalight.com/assets/files/ROM-DOS_Users_Guide.pdf |access-date=2018-09-16 |url-status=live |archive-url=https://web.archive.org/web/20190320151321/https://www.datalight.com/assets/files/ROM-DOS_Users_Guide.pdf |archive-date=2019-03-20}}</ref> <ref name="Ten_XP">{{cite web |title=Environment Variables in Windows 10 - Complete List of Environment Variables in Windows 10 |author-first=Shawn |author-last=Brink |date=2018-11-17 |work=Windows Ten Forums |url=https://www.tenforums.com/tutorials/3234-environment-variables-windows-10-a.html |access-date=2019-04-24 |url-status=live |archive-url=https://web.archive.org/web/20190327135346/https://www.tenforums.com/tutorials/3234-environment-variables-windows-10-a.html |archive-date=2019-03-27}}</ref> <ref name="Paul_1997_4DOSTIP">{{cite web |title=Hinweise zu JPSofts 4DOS 5.5b/c, 5.51, 5.52a und NDOS |work=MPDOSTIP |author-first=Matthias R. |author-last=Paul |date=1997-05-01 |orig-date=1995-03-01 |language=de |url=http://www.antonis.de/dos/dos-tuts/mpdostip/html/4dostip.htm |access-date=2015-05-08 |url-status=live |archive-url=https://web.archive.org/web/20161104211143/http://www.antonis.de/dos/dos-tuts/mpdostip/html/4dostip.htm |archive-date=2016-11-04}} (NB. The provided link points to a HTML-converted version of the <code>4DOS5TIP.TXT</code> file, which is part of the <code>MPDOSTIP.ZIP</code><!-- still named TIPS_MP.ZIP between 1991 and 1996-11 --> collection.) [https://web.archive.org/web/20190601152204/https://www.sac.sk/download/text/mpdostip.zip<!-- A yet older version 155 from 1997-05-13 of the 1997-07-15 distribution archive. -->]</ref> <ref name="Paul_2002_CTMOUSE">{{cite web |title=Re: [fd-dev] ANNOUNCE: CuteMouse 2.0 alpha 1 |author-first=Matthias R. |author-last=Paul |work=freedos-dev |date=2002-04-06 |url=https://marc.info/?l=freedos-dev&m=101807226917577 |access-date=2020-02-07 |url-status=live |archive-url=https://web.archive.org/web/20200207130948/https://marc.info/?l=freedos-dev&m=101807226917577&w=2 |archive-date=2020-02-07 |quote=[…] In CTMOUSE.ASM prepareTSR routine I found a comment in regard to the zero-environment. […] DESQview or DRDOS zero-env? […] release environment block […] skip if any problem […] zero-pad for MEM style utilities […]}}</ref> <ref name="ESR_2002_BROWSER">{{cite web |url=http://www.catb.org/~esr/BROWSER/index.html |title=The BROWSER project |last=Raymond |first=Eric |author-link=Eric S. Raymond |date=2002-08-02 |orig-date=Originally published 2001 |access-date=2020-10-21 |url-status=live |archive-url=https://web.archive.org/web/20190921223921/http://www.catb.org/~esr/BROWSER/index.html |archive-date=2019-09-21}}</ref> <ref name="LWN_2001_BROWSER">{{cite web |url=https://lwn.net/2001/0201/devel.php3 |title=LWN - Development |date=2001-02-01 |website=LWN.net |access-date=2020-10-21 |url-status=live |archive-url=https://web.archive.org/web/20190208125048/https://lwn.net/2001/0201/devel.php3 |archive-date=2019-02-08 |quote=Standardizing a BROWSER environment variable. Eric Raymond is promoting the use of a new environment variable, BROWSER, to complement the existing PAGER, MAILER, and EDITOR variables. This effort is being tested as an experiment in hacking social systems.}}</ref> <ref name="PERL_ENV_BROWSER">{{cite web |url=https://metacpan.org/pod/Env::Browser |title=Env::Browser-0.06 |last=Špaček |first=Michal |date=2020-01-19 |orig-date=First version published 2013 |website=metacpan.org |access-date=2020-10-21 |url-status=live |archive-url=https://web.archive.org/web/20201021202950/https://metacpan.org/pod/Env::Browser |archive-date=2020-10-21 |quote=Env::Browser - Process environment variable $BROWSER and run web browser}}</ref> <ref name="PYTHON_WEBBROWSER">{{cite web |url=https://docs.python.org/3/library/webbrowser.html |title=webbrowser — Convenient Web-browser controller |website=docs.python.org |access-date=2020-10-21 |url-status=live |archive-url=https://web.archive.org/web/20201013205951/https://docs.python.org/3/library/webbrowser.html |archive-date=2020-10-13}}</ref> <ref name="DEBIAN_DFLT_WEB_BROWSER">{{cite web |url=https://wiki.debian.org/DefaultWebBrowser |title=DefaultWebBrowser - Debian Wiki |date=2020-06-10 |website=wiki.debian.org |access-date=2020-10-21 |url-status=live |archive-url=https://web.archive.org/web/20201021204658/https://wiki.debian.org/DefaultWebBrowser |archive-date=2020-10-21 |quote=The environment variable BROWSER can be set to[…] always choose your desired browser.}}</ref> <ref name="GNU_BASH">{{cite web |title=Shell Variables |url=https://www.gnu.org/software/bash/manual/bash.html#Shell-Variables |website=Bash Reference Manual |access-date=2021-06-02 |archive-date=2018-03-15 |archive-url=https://web.archive.org/web/20180315115230/http://www.gnu.org/software/bash/manual/bash.html#Shell-Variables |url-status=live }}</ref> <ref name="Paul_2001_COUNTRY">{{cite web |title=DOS COUNTRY.SYS file format |type=COUNTRY.LST file |author-first=Matthias R. |author-last=Paul |date=2001-06-10 |edition=1.44 |orig-date=1995 |url=http://www.columbia.edu/~em36/wpdos/MatthiasPaulCPI.zip<!-- not an official distribution archive, but contains an older version of COUNTRY.LST --> |access-date=2016-08-20 |url-status=live |archive-url=https://web.archive.org/web/20160420065252/http://www.columbia.edu/~em36/wpdos/MatthiasPaulCPI.zip |archive-date=2016-04-20}}</ref> }}

==Further reading== * {{cite web |title=What are these strange =C: environment variables? |work=The New Old Thing |author-first=Raymond |author-last=Chen |author-link=Raymond Chen (Microsoft) |date=2010-05-06 |publisher=Microsoft |url=https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14133 |access-date=2025-04-03}}

== External links == * {{man|7|environ|Linux|user environment}} * {{man|7|environ|FreeBSD}} * {{man|7|environ|Darwin}} * {{man|7|environ|Solaris}} * {{cite web |title=Environment Variables Wiki |url=http://environmentvariables.org |archive-url=https://web.archive.org/web/20190427235415/http://environmentvariables.org/ |archive-date=2019-04-27}} * [https://msdn.microsoft.com/en-us/library/windows/desktop/bb776899%28v=vs.85%29.aspx User Environment Variables] * [https://web.archive.org/web/20180511150138/https://www.setx.cc/ fix setx.exe not found bug]

{{Unix commands}} {{Windows commands}}

Category:Operating system technology Category:Environment variables