Get Directory of Running Executable

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
 
R

Robert Jordan

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
 
A

Azhagan

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

-Azhagan.
 
S

Steve McLellan

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

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top