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. You can obtain: 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 ents and Settings \ WY} % TMP % {current user Temporary Folder-c: \ temporary E ~ 1 \ WY \ locals ~ 1 \ Temp} % Temp % {temporary folder of the current user-c: \ temporary E ~ 1 \ WY \ locals ~ 1 \ Temp} % appdata % {current user data folder-c: \ Documents ents and Settings \ WY \ Application Data} % ProgramFiles % { Program Default 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 number-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 ents 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 ents and Settings \ WY} end;