以程序实际路径为“D:/test/test.exe”时为例:
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(extractfileext(Application.Exename)); //实际显示为: exe
ShowMessage(extractfilename(Application.Exename)); //实际显示为: test.exe
ShowMessage(ExtractFilePath(Application.Exename)); //实际显示为: D:/test/
ShowMessage(ExtractFileDir(Application.Exename)); //实际显示为: D:/test (若为根目录,则有"/")end;
Delphi获取程序自身路径
最新推荐文章于 2023-02-22 11:40:42 发布