Previously used GetWindowsDirectory, GetSystemDirectory, GetTempPath and other functions to obtain the system commonly used folders;
Also used shgetspecialfolderlocation, shgetpathfromidlist function to obtain more common paths;
But this is not as fast as getting system variables with getenvironmentvariable.
For example,%WINDIR% is a system variable that represents the system directory,which can be obtained:varstring; 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% {Current User root directory-C:}%USERPROFILE% {Current User directory-C:\Documents and Settings\wy}%homepath% {Current user path-\documents and Settings\wy}%TMP% {Current User temp folder-c:\docume~1\wy\locals~1\temp}%temp% {Current User temp folder-c:\docume~1\wy\locals~1\temp}%appdata% {Current User Data folder-C:\Documents and Settings\wy\application%PROGRAMFILES% {Program default installation directory-C:\Program Files}%commonprogramfiles% {File Universal directory-C:\Program Files\Common Files}%USERNAME% {Current user name-WY}%allusersprofile% {All user files directory-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% {The domain containing the user account-ibm-b63851e95c9}%comspec% {C:\WINDOWS\system32\cmd.exe}%pathext% {Execute file type-. COM;. EXE;. BAT;. CMD;. VBS;. VBE;. JS;. JSE;. WSF;. WSH;. PYO;. PYc;. py;. Pyw%PATH% {Search Path}
In addition, you can take advantage of: To the upper-level directory, such as:
var string; begin S: = Getcurrentdir; ShowMessage (s); {C:\Documents and settings\wy\my Documents\rad studio\projects} Setcurrentdir ('.. ') ); s: = Getcurrentdir; ShowMessage (s); {C:\Documents and settings\wy\my Documents\rad Studio} Setcurrentdir ('.. \..‘ ); s: = Getcurrentdir; ShowMessage (s); {C:\Documents and Settings\wy} End;
[Go] Get common system environment variables with getenvironmentvariable