Get Directory of Running Executable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

It it possible to the directory that the executable is running from? At the
moment I've been trying to use...

Directory.GetCurrentDirectory();

....but the problem with this is that if I have an installer that puts a
shortcut in the Start Menu it classes the current directory as the start menu
location rather than in c:\program files\blah. Is there any way around this?

Darrell
 
Hi!
It it possible to the directory that the executable is running from? At the
moment I've been trying to use...

Directory.GetCurrentDirectory();

...but the problem with this is that if I have an installer that puts a
shortcut in the Start Menu it classes the current directory as the start menu
location rather than in c:\program files\blah. Is there any way around this?

Either fix the installer to preset the working directory,
or use System.IO.Path.GetDirectoryName(Application.ExecutablePath).

bye
Rob
 
You might want to try Assembly.GetExecutingAssembly().Location property
in the System.Reflection namespace.

-Azhagan.
 
In addition to the other posters, Application::StartupPath also seems to
work.

Steve
 
Back
Top