Sign in Join
FPDoc Onlineexperiment

GetEnvironmentString function

In unit sysutils

Return an environment variable by index.

Declaration

pascal
function GetEnvironmentString(Index: Integer): RTLString

Description

GetEnvironmentString returns the Index-th environment variable. The index is 1 based, and is bounded from above by the result of GetEnvironmentVariableCount.

For an example, GetEnvironmentVariableCount.

Note that on Windows, environment strings can start with an equal sign (=). This is a trick used to pass the current working directory to a newly created process. In this case, extracting the variable name as the characters before the first equal sign will result in an empty name.

Errors

If there is no environment, an empty string is returned.

See also

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