Use and display::Environment variable


Variable::anchor    Command::windows    DR-DOS::under    COMMAND::current    Ordner::schulz    System::returns

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

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

In DOS, OS/2 and Windows command-line interpreters such as COMMAND.COM and cmd.exe, the user has to type this:

<source lang="dos"> ECHO %HOME% </source>

In Windows PowerShell, the user has to type this:

<source lang="powershell"> Write-Output $env:HOMEPATH </source>

The commands env, set, and printenv display all environment variables and their values. printenv can also be used to print a single variable by giving that variable name as the sole argument to the command.

Environment variable sections
Intro   Details    Use and display    Assignment    True environment variables    Pseudo-environment variables   Critics   See also   References   External links   

Use and display
PREVIOUS: IntroNEXT: Details