System.SysUtils.GetEnvironmentVariable
Delphi
function GetEnvironmentVariable(const Name: string): string;
C++
extern DELPHI_PACKAGE System::UnicodeString __fastcall GetEnvironmentVariable(const System::UnicodeString Name)/* overload */;
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
Retrieves an environment variable value.
Call GetEnvironmentVariable to retrieve the value of an environment variable, passed as Name, for the current process.
Note: The case of the specified environment variable Name is ignored.
The following table defines the standard environment variables for Microsoft Windows.
| Environment variable name | Environment value |
|---|---|
|
ALLUSERSPROFILE |
Generic user profile. |
|
APPDATA |
Path of the application data folder. |
|
CLIENTNAME |
Name of Client machine. |
|
COMMONPROGRAMFILES |
Path of common program files folder. |
|
COMPUTERNAME |
Name of Computer code is running on. |
|
COMSPEC |
Path of the cmd.exe program. |
|
HOMEDRIVE |
Current home drive designation, such as 'C:' |
|
HOMEPATH |
Path to current location for document storage. |
|
LOGONSERVER |
Specifies a domain controller for user logon authentication. |
|
NUMBER_OF_PROCESSORS |
Number of processors on current machine. |
|
OS |
Base name of the Operating System. Note that Windows XP is given as Windows_NT. |
|
PATH |
The current program path. |
|
PATHEXT |
Extension types of executable files. |
|
PROCESSOR_ARCHITECTURE |
Type of CPU architecture. For example, X86 for Intel Pentium processors. |
|
PROCESSOR_IDENTIFIER |
ID number of current machine. |
|
PROCESSOR_LEVEL |
More detailed description of the CPU architecture. |
|
PROCESSOR_REVISION |
Processor revision level. |
|
PROGRAMFILES |
Path of the program files folder. |
|
SESSIONNAME |
Name of the current OS session. |
|
SYSTEMDRIVE |
Drive the OS operates from. |
|
SYSTEMROOT |
Sets the system directory. |
|
TEMP |
Path of the temporary files folder. |
|
TMP |
Directory to store temporary files to. |
|
USERDOMAIN |
Specifies the domain of the current machine. |
|
USERNAME |
Name of the current user. |
|
USERPROFILE |
Path of the folder holding the current user's information. |
|
WINDIR |
Path of the Windows folder. |