00 Votes

Delphi: Read out folder of our own application

Tip by Delphian | 2012-07-17 at 21:58

Delphi and Lazarus make it easy for us to get the directory, in which our application exe file is saved. This line of code gives us the path of our program:

// path is a string
path := ExtractFilePath(ParamStr(0));

ParamStr(0) contains the full path and file name of our application. With the help of ExtractFilePath(), we extract only the path.

Alternatively, you can also use Application.Exename instead of ParamStr(0). Application.Exename also contains the complete path and the filename of the application.

ReplyPositiveNegative

About the Author

AvatarThe author has not added a profile short description yet.
Show Profile

 

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.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.