Unit 'Dos' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#rtl]

GetEnv

Get environment variable by name.

Declaration

Source position: dosh.inc line 120

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.

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: Nov 24 2024