Returns the value of the specified environment variable.
||An expression that resolves to the name of an environment variable, specified as a quoted string.
function returns the current value of the specified environment variable. Environment variable names are not case-sensitive.
If the specified name
is a literal or a defined variable that is not an environment variable, GETENV
returns an empty string. If name
is a system variable
(@ variable) that has a current value, GETENV
returns an empty string; if name
is an @ variable that does not have a current non-null value, GETENV
generates an <ILLEGAL VALUE> error.
On a Windows system, you can display a list of all of your environment variables by issuing the SH
MultiValue command from the MultiValue Shell prompt, as follows:
To create a file containing this list, you can use the following MultiValue command:
USER:[ WRITE $ZF(-1,"set>c:\temp\myenvset.txt")
The following example returns the PATH environment variable:
The following example returns the operating system environment variable:
The following example returns the current username environment variable: