RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.GetEnvironmentVariable Function

Retrieves an environment variable value.

Pascal
function GetEnvironmentVariable(const Name: string): string; overload;
C++
AnsiString GetEnvironmentVariable(const AnsiString Name);

SysUtils

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  
 
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  
 
PROCESSOR_ARCHITECTURE  
Type of CPU architecture. For example, X86 for Intel Pentium processors.  
PROCESSOR_IDENTIFIER  
 
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  
 
TEMP  
Path of the temporary files folder.  
TMP  
 
USERDOMAIN  
 
USERNAME  
Name of the current user.  
USERPROFILE  
Path of the folder holding the current user's information.  
WINDIR  
Path of the Windows folder.  

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!