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.

Exists class method

Project: Environment Variables Unit

Unit: PJEnvVars

Class: TPJEnvironmentVars

Applies to: ~>3.0

class function Exists(const VarName: string): Boolean;


Checks if a given environment variable exists in the current process.



Important: Don’t be tempted to simply check if the GetValue method returns the empty string to determine whether an environment variable exists or not. GetValue will return the empty string in two cases: (1) if the environment variable exists but has an empty value and (2) if the environment variable does not exist. Exists returns True in the former case and False in the latter.