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.
Parameters:
Returns
True if the environment variable exists or False if it does not.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
Truein the former case andFalsein the latter.