Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get an application's process name?

Tags:

c#

I am trying to develop a sample application that finds the process name of a particular application.. Suppose there is an application by name XYZ.exe.. But when the XYZ.exe application is executed, it is not necessary that it holds the same process name.. Let the application run under the process name abc.exe..

Now my question is this.. Is it possible to find the process name of XYZ.exe?

Any help would much appreciated...

Thanks, Ram

like image 661
Ram Avatar asked Apr 26 '10 10:04

Ram


People also ask

How do I find the process name of an application?

Quick tip: You can also open the app by right-clicking the taskbar and selecting the Task Manager option, right-clicking the Start button and selecting the Task Manager option, or using the Ctrl + Shift + Esc keyboard shortcut. Click the Details tab. Confirm the Process ID of the app in the PID column.

How to Find process by name in Windows?

In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column. Click on any column name to sort. You can right click a process name to see more options for a process.

What is a ProcessName?

The ProcessName property holds an executable file name, such as Outlook, that does not include the .exe extension or the path. It is helpful for getting and manipulating all the processes that are associated with the same executable file.

What is process of application?

What is a Process Application? A process app (or workflow app) is a custom application that includes forms, workflows, and reports that automate a specific process. These apps are usually built using low-code development tools that speed design and implementation and can be used by non-developers.


1 Answers

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 { }
}
like image 161
Lukas Šalkauskas Avatar answered Sep 18 '22 18:09

Lukas Šalkauskas