How to get the name of the application?

I am trying to develop an example application that finds the process name for a specific application. Suppose there is an application called XYZ.exe . But when XYZ.exe , it is not necessary that it contains the same process name. Let the application run under the process name abc.exe ..

Now my question is: is it possible to find the process name XYZ.exe ?

Any help would be greatly appreciated ...

Thanks Ram

+6
c #
source share
1 answer

It's simple:

foreach (Process pr in Process.GetProcesses()) { try { Console.WriteLine("App Name: {0}, Process Name: {1}", Path.GetFileName(pr.MainModule.FileName), pr.ProcessName); } catch { } } 
+4
source share

All Articles