GetEnvironment

GetEnvironment["var"]

gives the setting corresponding to the variable "var" in the operating system environment.

GetEnvironment[{"var1","var2",}]

gives a list of rules, corresponding to specified environment variables.

GetEnvironment[]

gives information about all existing settings in the operating system environment.

Details

  • GetEnvironment[All] is the same as GetEnvironment[].
  • GetEnvironment returns results in the form "var"->value, where value is the value of a corresponding environment variable "var".
  • If the variable "var" is found in the environment, the value is a string, possibly empty.
  • If the variable "var" is not defined in the environment, GetEnvironment returns "var"->None.
  • Names and values of the variables defined in the operating system environment depend on the computer system you are using.

Examples

Basic Examples  (5)

Get a value for the environment variable "HOME":

Value for the undefined environment variable:

Find all defined environment variables:

Get values for several variables:

Environment variables are accessible to child processes. On Windows:

On Unix:

Wolfram Research (2012), GetEnvironment, Wolfram Language function, https://reference.wolfram.com/language/ref/GetEnvironment.html.

Text

Wolfram Research (2012), GetEnvironment, Wolfram Language function, https://reference.wolfram.com/language/ref/GetEnvironment.html.

CMS

Wolfram Language. 2012. "GetEnvironment." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/GetEnvironment.html.

APA

Wolfram Language. (2012). GetEnvironment. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GetEnvironment.html

BibTeX

@misc{reference.wolfram_2024_getenvironment, author="Wolfram Research", title="{GetEnvironment}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/GetEnvironment.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_getenvironment, organization={Wolfram Research}, title={GetEnvironment}, year={2012}, url={https://reference.wolfram.com/language/ref/GetEnvironment.html}, note=[Accessed: 22-November-2024 ]}