how can i get directory path in window application ??

currently i m working on windows application ....
i want to know that how can i get directory path in window application ??

for ex ...

C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Question_Assistant\Question_Assistant

now how can i get the above path using command ??
Who is Participating?
Sudhakar PulivarthiConnect With a Mentor Project Lead - EngineeringCommented:
When exe1 calls exe2 then in exe2 when we try to get in the above way using Application we will get the exe1 path information not the exe2.
To get the exe2 info then we can get using:
string path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase

Note: This way will get even the exe1 path when used in exe1 also.
Deepu AbrahamR & D Engineering ManagerCommented:
Try this:

String name = System.Windows.Forms.Application.ExecutablePath;
Carl TawnSystems and Integration DeveloperCommented:
Application.StartupPath is the path your exe is running from.
Sudhakar PulivarthiProject Lead - EngineeringCommented:
Application.ExecutablePath will get the path for the executable file that started the application, including the executable name.  
Application.StartupPath will get the path of the executable file that started the application, not including the executable name.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.