//譬如 WINDIR 是表示系統目錄的系統變量, 可以這樣獲取:
var
s: string;
begin
s := GetEnvironmentVariable('WINDIR');
ShowMessage(s); {C:Windows}
end;
(*--------------------------------------------------------------------------------
WINDIR {系統目錄 - C:Windows}
SYSTEMROOT {系統目錄 - C:Windows}
SYSTEMDRIVE {系統根目錄 - C:}
HOMEDRIVE {當前用戶根目錄 - C:}
USERPROFILE {當前用戶目錄 - C:Documents and Settingswy}
HOMEPATH {當前用戶路徑 - Documents and Settingswy}
TMP {當前用戶臨時文件夾 - C:DOCUME~1wyLOCALS~1Temp}
TEMP {當前用戶臨時文件夾 - C:DOCUME~1wyLOCALS~1Temp}
APPDATA {當前用戶數據文件夾 - C:Documents and SettingswyApplication Data}
PROGRAMFILES {程序默認安裝目錄 - C:Program Files}
COMMONPROGRAMFILES {文件通用目錄 - C:Program FilesCommon Files}
USERNAME {當前用戶名 - wy}
ALLUSERSPROFILE {所有用戶文件目錄 - C:Documents and SettingsAll Users}
OS {操作系統名 - Windows_NT}
COMPUTERNAME {計算機名 - IBM-B63851E95C9}
NUMBER_OF_PROCESSORS {處理器個數 - 1}
PROCESSOR_ARCHITECTURE {處理器芯片架構 - x86}
PROCESSOR_LEVEL {處理器型號 - 6}
PROCESSOR_REVISION {處理器修訂號 - 0905}
USERDOMAIN {包含用戶帳號的域 - IBM-B63851E95C9}
COMSPEC {C:Windowssystem32cmd.exe}
PATHEXT {執行文件類型 - .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.pyo;.pyc;.py;.pyw}
Path {搜索路徑} s: string;
--------------------------------------------------------------------------------*)
begin
s := GetCurrentDir;
ShowMessage(s); {C:Documents and SettingswyMy DocumentsRAD StudioProjects}
SetCurrentDir('..');
s := GetCurrentDir;
ShowMessage(s); {C:Documents and SettingswyMy DocumentsRAD Studio}
SetCurrentDir('....');
s := GetCurrentDir;
ShowMessage(s); {C:Documents and Settingswy}
end;