How can I get my exe path?

  • Thread starter Thread starter Tony Caduto
  • Start date Start date
T

Tony Caduto

Hi,
In Delphi I could use paramstr(0) to get the full path to my exe during
runtime.
Does anyone know the C# equivilent?

Thanks a bunch,
 
Jay said:
use the following
this.GetType().Assembly.CodeBase

This points to the dir of the current Assembly (if your assembly is NOT the
EXE it will might point to the wrong directory...)
 
Hi,
In Delphi I could use paramstr(0) to get the full path to my exe during
runtime.
Does anyone know the C# equivilent?

Application.ExecutablePath

This also includes the name of the .exe.

Use the static method Path.GetDirectoryname on the Executable string
to exclude the exenam.exe part.

Oz
 
Back
Top