There were several other similar posts, but I could not pinpoint one that relates entirely to my issue.
Simply put, say my application exe file is located in C:\MyApp\run.exe
,
how can I find the programatically find the path C:\MyApp
using System.IO;
using System.Windows.Forms;
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
UPDATE:
For a WPF application you could use the following:
using System.Reflection;
string appPath = Assembly.GetExecutingAssembly().Location;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With