Environment Variable Management code & component 1.2

By Peter Johnson

Freeware 08 Apr 2004

In category

Components > System > System


This unit provides a component and various routines for manipulating environment variables. Features include:
  • A component to enumerate all available environment variables and to get, set and delete variables.
  • A set of routines effectively duplicating facilities of component, but also able to create a string list containing information about all environment variables.
  • A routine to replace a environment variable name references within a string with the values of the variables.
  • A routine to create a customised environment block for passing to child processes.
A help file is supplied which integrates into the Delphi 3 to 7 IDE and provides help on the component and routines.

This component and routines are essentially wrappers around the following Windows API calls:

  • GetEnvironmentVariable: returns the value of a given environment variable.
  • SetEnvironmentVariable: sets an environment variable’s value.
  • GetEnvironmentStrings: gets a list of all available environment variables.
  • ExpandEnvironmentStrings: replaces all ’%’ delimited environment variable names in a string with the variables’ values.
To learn about the use and manipulation of environment variables check out the article linked to from the component’s home page.


  • Status: Fully functional
  • Source: FW
  • Size: 18 200kB


  • Delphi 3
  • Delphi 4
  • Delphi 5
  • Delphi 6
  • Delphi 7