[Overview][Constants][Types][Procedures and functions][Variables][Index] | Reference for unit 'Dos' (#rtl)

# GetEnv

Get environment variable by name.

## Declaration

Source position: dosh.inc line 125

`function GetEnv(`
`envvar: string`
`):string;`

## Description

Getenv returns the value of the environment variable EnvVar. When there is no environment variable EnvVar defined, an empty string is returned.

Remark: | Under some operating systems (such as unix), case is important when looking for EnvVar.

## Errors

None.

## See also

EnvCount |  | Return the number of environment variables
EnvStr |  | Return environment variable by index

## Example

    Program Example14;
    uses Dos;

    { Program to demonstrate the GetEnv function. }

    begin
      WriteLn('Current PATH is ',GetEnv('PATH'));
    end.

Documentation generated on: Feb 26 2014