How do I find out what directory my console app is running in?

John Sheehan picture John Sheehan · Sep 18, 2008 · Viewed 60.8k times · Source

How do I find out what directory my console app is running in with C#?

Answer

Hallgrim picture Hallgrim · Sep 18, 2008

To get the directory where the .exe file is:

AppDomain.CurrentDomain.BaseDirectory

To get the current directory:

Environment.CurrentDirectory