How to get the full path of running process?

 using System.Diagnostics;
 var process = Process.GetCurrentProcess(); // Or whatever method you are using
 string fullPath = process.MainModule.FileName;
 //fullPath has the path to exe.

There is one catch with this API, if you are running this code in 32 bit application, you’ll not be able to access 64-bit application paths, so you’d have to compile and run you app as 64-bit application (Project Properties → Build → Platform Target → x64).

Leave a Comment