Sign in Join
FPDoc Onlineexperiment

GetEnv function

In unit Dos

Get environment variable by name.

Declaration

pascal
function GetEnv(envvar: shortstring): shortstring

Description

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

Under some operating systems (such as Unix), case is important when looking for EnvVar.

Errors

None.

See also

Example: ex14

pascal
Program Example14;
uses Dos;

{ Program to demonstrate the GetEnv function. }

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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.