-1 1 Vote

Delphi/Lazarus: Get Program Folder / Path of own Application

Question by Compi | 04/06/2016 at 18:44

I would like to determine the folder in which my program file respectively the EXE file of my application is stored. In other words, the directory from which the program has been started and in which accordingly the EXE is located.

Is there any function available for that?



Show Profile | Message
1Best Answer
1 Vote

That is quite easy. In Paramstr(0) as well as in Application.ExeName, the full path to your application file is stored.

In order to get the corresponding folder, you only have to extract the path from Paramstr(0) or Application.ExeName.

  AppFolder: string;
  AppFolder := ExtractFilePath(Application.ExeName);

  // or

  AppFilder := ExtractFilePath(Paramstr(0));

As you can see, you can achieve this with using the function ExtractFilePath(). In this case, this function is cutting off the program files from the path and is correspondingly providing the desired path to your EXE.
04/06/2016 at 19:14

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own articles on askingbox.com. How to do.