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

GetEnvironmentString

Return an environment variable by index.

Declaration

Source position: osutilsh.inc line 27

function GetEnvironmentString(

  Index: Integer

):AnsiString;

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.

Remark: 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 proces. 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

GetEnvironmentVariable

  

Return the value of an environment variable.

GetEnvironmentVariableCount

  

Return the number of variables in the environment.


Documentation generated on: Mar 17 2017