By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,671 Members | 1,387 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,671 IT Pros & Developers. It's quick & easy.

The directory the program is launched from?

P: n/a
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
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Peter" <an*******@discussions.microsoft.com> wrote in
message
news:D0**********************************@microsof t.com...
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
Nov 15 '05 #2

P: n/a
Markus Seger wrote:
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)
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.