Environment Variable Management Unit



This unit provides a component and a set of routines for managing and manipulating environment variables.


The unit is compatible with Delphi 3 to 7. It has been tested with Delphi 4, 6 and 7.


In these instructions $(DELPHI) is to be taken to represent the path where the appropriate version of Delphi was installed. For example, if you have Delphi 4 installed on the default installation path then $(DELPHI) is equivalent to C:\Program Files\Borland\Delphi4.

Installation with Delphi 3 & later

  1. Unzip the file pjenvvar.zip into a folder, preserving the directory structure.
  2. Copy PJEnvVars.pas and PJEnvVars.dcr to the folder from where you wish to install the component into the Delphi Component Palette. This will probably be a sub-folder of the $(DELPHI)\lib folder.
  3. Install the component into the palette by chosing the Component | Install Component menu option.
  4. You can now delete PJEnvVars.pas from the place where you copied it if you wish. The component will appear on a palette called DelphiDabbler. You can move the component to a different palette if required.
  5. The simplest way to install the help file is to use my Component Help Installer Expert. To install manually, proceed as follows:

Known Issues

In versions up to 1.1 an error was triggered if an attempt was made to read a non-existant environment variable. Bug fixed in v1.2

Update History

Release 1.0 of 02 Sep 2001
PJEnvVars v1.0 of 02 Sep 2001

Not released
PJEnvVars v1.1 of 31 Jul 2003

Release 1.2 of 10 Aug 2003
PJEnvVars v1.2 of 10 Aug 2003

License & Disclaimer

This unit and help file are copyright © P.D.Johnson, 2001-2003.

The source code and help files can be freely distributed on a not-for-profit basis providing that:

  1. the source code is not altered
  2. this file is distributed with it unchanged.

By not-for-profit I mean that you may recover out of pocket expenses incurred in distributing the code, but should not make a profit from this.

If you discover any bugs in this implementation, or if you have any update suggestions, please contact me at peter.johnson@openlink.org.

Please do modify the code for you own use. I'd like to see any changes you make - I could incorporate them into future versions. Please notify me of changes on at the above e-mail address.

This software is provided as is - no warranty is given as to its suitability for any purposes to which you may wish to put it.

About the Author

I'm Peter Johnson - a hobbyist programmer living in Ceredigion in West Wales, UK, writing mainly in Delphi. My programs are available for download on my web-site: http://www.delphidabbler.com/.

I can be contacted by e-mail at peter.johnson@openlink.org.