How to Get Path of Running Application in C#

Sharing is Caring

Getting the path of the running application is really simple, and is pretty important if you allow the user to install the application anywhere (which you really should do!) I’ve just included the way to do it for windows forms, but it isn’t that hard to adopt to other situations.


using System.IO;
using System.Windows.Forms;

//......

string executing = Path.GetDirectoryName(Application.ExecutablePath);

Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.