Delphi/Lazarus: Get Program Folder / Path of own Application
Question by Compi | Last update on 2021-07-01 | Created on 2016-06-04
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?
Related Topics
Rename File to its Folder Name
Tutorial | 0 Comments
MIME Types of Microsoft Office File Formats
Info | 0 Comments
Delphi/Lazarus: Command Line Parameter Tutorial Part 1: Sending
Tutorial | 0 Comments
Delphi: Global Treatment of Errors (Exceptions)
Tutorial | 0 Comments
Delphi/Lazarus: Difference between ParamStr(0) and Application.ExeName
Question | 1 Answer
Delphi: System-Wide HotKey
Tutorial | 1 Comment
Lazarus: Open File or Document platform-independent
Tip | 0 Comments
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.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
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.
As you can see, you can achieve this with using the function ExtractFilePath(). In this case, this function is cutting off the program file from the path and is correspondingly providing the desired path to your EXE.
Last update on 2021-07-01 | Created on 2016-06-04