Previously, we used functions such as getwindowsdirectory, getsystemdirectory, and gettemppath to obtain common system folders;
You have also used the shgetspecialfolderlocation and shgetpathfromidlist functions to obtain more common paths;
However, it is better to use getenvironmentvariable to obtain the system variable token quickly.
// For example, % WINDIR % indicates the system variable of the system directory, which can be obtained as follows:
VaR
S: string;
Begin
S: = getenvironmentvariable ('windir ');
Showmessage (s); {C:/Windows}
End;
% WINDIR % {system directory-C:/Windows}
% SystemRoot % {system directory-C:/Windows}
% Systemdrive % {system root directory-C :}
% Homedrive % {root directory of the current user-C :}
% USERPROFILE % {current user directory-C:/Documents ents and settings/WY}
% Homepath % {current user path-/Documents and Settings/WY}
% TMP % {temporary folder of the current user-C:/cmde ~ 1/WY/locals ~ 1/temp}
% Temp % {temporary folder of the current user-C:/cmde ~ 1/WY/locals ~ 1/temp}
% Appdata % {current user data folder-C:/Documents and Settings/WY/Application Data}
% ProgramFiles % {default program installation directory-C:/Program Files}
% Commonprogramfiles % {common file directory-C:/program files/common files}
% Username % {current user name-Wy}
% Allusersprofile % {all user file directories-C:/Documents and Settings/all users}
% OS % {operating system name-windows_nt}
% Computername % {computer name-IBM-B63851E95C9}
% Number_of_processors % {Number of processors-1}
% Processor_architecture % {processor chip architecture-x86}
% Processor_level % {Processor Model-6}
% Processor_revision % {processor Revision No.-0905}
% Userdomain % {domain containing user account-IBM-B63851E95C9}
% Comspec % {C:/Windows/system32/cmd.exe}
% Pathext % {execution file type -. com ;. EXE ;. BAT ;. CMD ;. vbs ;. VBE ;. JS ;. JSE ;. WSF ;. wsh ;. pyo ;. pyC ;. PY ;. pyw}
% PATH % {search path}
In addition, you can use... to go to the upper directory, such:
VaR
S: string;
Begin
S: = getcurrentdir;
Showmessage (s); {C:/Documents and Settings/WY/My Documents ents/rad studio/projects}
Setcurrentdir ('..');
S: = getcurrentdir;
Showmessage (s); {C:/Documents and Settings/WY/My Documents ents/rad studio}
Setcurrentdir ('../..');
S: = getcurrentdir;
Showmessage (s); {C:/Documents and Settings/WY}
End;