The directory the program is launched from?

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

Guest

Hello,

Thanks for looking at my question. This is an easy one. When my program is launched, I would like to know the directory it was launched from. Do you know where I can get this information?

Peter
 
message
Hello,

Thanks for looking at my question. This is an easy one. When my program is launched,
I would like to know the directory it was launched from. Do you know where I can get
this information?

Peter,

look at the Application.StartupPath property.

Markus
 
Markus said:
look at the Application.StartupPath property.

That returns the path to the executable which started your application. If
your app is launched or hosted by another, the results will be misleading.

To get the path to your assembly, use
System.Reflection.Assembly.GetExecutingAssembly().Location.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 

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

Back
Top