Page 1 of 1

Getting the directory path of delphi exe?

PostPosted: April 17th, 2008, 2:55 pm
by sekar1
hi,

i have a small question. is it possible to get the directory path in which deplhi exe running.

i will explain with small example:

i stored the deplhi exe of my project in c:\projects\dirpathretrivel\project.exe. if i run the exe, a message should appear that the exe is in "c:\projects\dirpathretrivel\" path.

is there any inbuilt command available to perform this operation or we need write function. if any command is not available means, please do help how to do this?

PostPosted: April 17th, 2008, 6:04 pm
by HPW
How about:

Application.ExeName or ParamStr(0)

PostPosted: April 17th, 2008, 8:15 pm
by geowink
I use this function...

// Return the executable file path with or without trailing backslash.
function Exe_Dir( TrailSlash : Boolean ) : String;
begin
Result := Set_Path( ExtractFilePath(ParamStr(0)), TrailSlash );
end;

George