Previous: 4.24.2.7. EnvCount To the Table of Contents Next: 4.24.2.9. Exec
4.24.2.7. EnvCount Table of Contents 4.24.2.9. Exec

- 4.24.2.8. -
Table of Contents
4. Standard Units
4.24. DOS - MSDOS support unit
4.24.2. DOS Unit Procedures and Functions
4.24.2.8. EnvStr


4.24.2.8. EnvStr

Targets: MS-DOS, OS/2, Win32


Dos Unit

Returns a specified environment string.

Declaration:
function EnvStr(Index: Integer): string;
Remarks:
Index is the number of the environment variable, for instance, the first variable is one, second is two, and so on. An invalid index returns an empty string.

EnvStr returns a string in the form of (VarName=String). If the order of system environment variables is unknown then use GetEnv to retrieve a variable by name.

Example:
uses
  Dos;
var
  i : Integer;
begin
  for i := 1 to EnvCount do
    WriteLn(EnvStr(i));
end.
See also:
EnvCount
GetEnv


Previous: 4.24.2.7. EnvCount To the Table of Contents Next: 4.24.2.9. Exec
4.24.2.7. EnvCount Table of Contents 4.24.2.9. Exec

- 4.24.2.8. -