Runtime.GetEnvironmentVariable

Prototypes

static String GetEnvironmentVariable( String sName )

Return Value

If the specified operating system environment variable is defined, the return value is a reference to a String object containing the environment variable's value. If the specified environment variable is not defined, the return value is a reference to an empty String object. If you assign the return value to a matrix, you can use the NLENG function to determine whether the environment variable is defined:

value = Runtime.GetEnvironmentVariable( "TEMP" );
if nleng(value) = 0 then
    print "Not defined";
else
    print "Defined";

Note that there is no way to distinguish between an undefined environment variable and an environment variable that is defined but has no value.

Parameters

String sName
The name of the environment variable to retrieve. The name is not case sensitive.

Remarks

This method returns the value of an operating system environment variable.

Example
ospath = Runtime.GetEnvironmentVariable( "PATH" );
NumItems = countw( ospath, ";" );
do i = 1 to NumItems;
    path = path // scan( ospath, i, ";" );
end;
print path;
See Also

Runtime.SetEnvironmentVariable