Caché MultiValue Basic Reference
GETENV
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the value of the specified environment variable.
Synopsis
GETENV(name)
Arguments
name An expression that resolves to the name of an environment variable, specified as a quoted string.
Description
The GETENV 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:
USER:SH set
To create a file containing this list, you can use the following MultiValue command:
USER:[ WRITE $ZF(-1,"set>c:\temp\myenvset.txt")
Examples
The following example returns the PATH environment variable:
  PRINT GETENV("PATH")    
The following example returns the operating system environment variable:
  PRINT GETENV("OS")    
The following example returns the current username environment variable:
  PRINT GETENV("USERNAME")    
See Also