There are Extractfiledir and extractfilepath two similar functions in the Delphi sysutils unit, and two functions have the following differences:
Extractfilepath returns the last character of the value is the backslash "/".
ShowMessage (Extractfiledir (application.exename)); The return value is C:/temp
ShowMessage (Extractfilepath (application.exename)); The return value is c:/temp/
Same point: If the execution file is in the root directory (such as: c:/sample). EXE), the return value of both is the same, and the last character is "/".
===============================================================================
Edit1. TEXT:=PARAMSTR (0)//own full path C:/555/qq.exe, available for console
Edit1.text:=expandfilename (paramstr (0)); Get the full path to this program C:/qq/2.exe
Edit2.text:=extractfiledir (paramstr (0)); Get the path to this program C:/QQ
Edit3.text:=application. EXEName; Get the full path to this program C:/qq/2.exe, same as 1th
Edit4.text:=extractfilename (Application.exename); Get filename 2.exe
Expandfilename () returns the full path to the file (including the drive, path)
Extractfileext () extracts the extension
Extractfilename () from the file name
to extract the file name without the path Extractfilepath () Extracts the pathname from the file name
Extractfiledir () extracts the directory name from the file name
Extractfiledrive () extracts the drive name from the file name
Changefileext () Change file extension
Expanduncfilename () returns the file full path containing the network drive
Extractrelativepath () extracts relative path information from file name
Extractshortpathname () Converts the file name to DOS 8 3 format
Matchesmask () checks to see if the file matches the specified file name format