How can we figure out the filesystem location of the running application?
Asked
Active
Viewed 213 times
-3
-
Are you looking for [`Directory.GetCurrentDirectory`](http://msdn.microsoft.com/en-us/library/system.io.directory.getcurrentdirectory(v=vs.110).aspx) – Harrison Jan 06 '14 at 21:41
-
1That would depend on the type of application: console, winforms, wpf, asp.net, windows phone, ... I hope you realize that the fact that you tagged your question with C# is pretty meaningless in this context. – Darin Dimitrov Jan 06 '14 at 21:41
-
application.info.path and many other properties will help you – Ali.Rashidi Jan 06 '14 at 21:42
-
3... or [this](http://stackoverflow.com/questions/6041332/best-way-to-get-application-folder-path) or [this](http://stackoverflow.com/questions/7025269/c-sharp-executable-executing-directory) or [this](http://stackoverflow.com/questions/5606747/how-to-get-application-path) or [this](http://stackoverflow.com/questions/362790/what-is-the-best-way-to-determine-application-root-directory) or [this](http://stackoverflow.com/questions/881251/how-to-get-the-path-of-appwithout-app-exe) ... if the site suggests to check whether your question has been asked before, **please do so**. – O. R. Mapper Jan 06 '14 at 21:44
2 Answers
2
If you work on Console use this
AppDomain.CurrentDomain.BaseDirectory
or on Windows Forms use
Application.StartupPath

Omer
- 8,194
- 13
- 74
- 92
-
3@TravisBanger: Your question does not give any indication of that. You should add the appropriate tags. Pro tip: With the WPF reference added, your question is a duplicate of [this question](http://stackoverflow.com/questions/938421/getting-the-applications-directory-from-a-wpf-application) and [that one](http://stackoverflow.com/questions/10926506/how-to-get-current-application-path-in-wpf). – O. R. Mapper Jan 06 '14 at 21:47