Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

TPJEnvVars component

Project: Environment Variables Unit

Unit: PJEnvVars

Applies to: ~>3.0

⚠️ This component is deprecated and is retained for backward compatibility only. New code should use the TPJEnvironmentVars static class instead.


TPJEnvVars provides access to the environment variables in the current process’ environment block. Environment variables can be read, created, updated or deleted. The names of all available environment variables can also be enumerated.

Only one instance of a TPJEnvVars component can be placed on any form or frame. An attempt to create duplicate instances on a form causes an exception to be raised.


Method Description
Create Constructs an instance of the component.
DeleteVar Deletes an environment variable.
EnumNames Enumerates all environment variable names, passing each name to a callback method.
GetEnumerator Creates an enumerator that can be used to enumerate all environment variable names. On Delphi 2005 and later this enumerator enables the component to be used for..in loops.


Property Description
Count Returns the number of available environment variables.
Values Provides read / write access to environment variables.


TPJEnvVars exposes no events.