Listing and termination of processes in .Net

How can I list and terminate existing processes in a .Net application? The target applications are 1) .Net applications, 2) they are instances of the same executable file 3) they have unique identifiers, but I do not know how to get this information from them, 4) they are generated from the outside (i.e. I don’t have them handled since I do not create them).

I want to list all the processes, get unique identifiers from them, and restart some of them. I assume they are all responsive.

+3
source share
3 answers

, this . WCF . . (Process.GetCurrentProcess().Id).

. Windows. process.MainWindowHandle . . . , pinvoke .

+1

Process.GetProcesses . (, LINQ), , .

System.Diagnostics.Process.GetProcesses()
+2
Process.Kill();

Check this out for the destruction process: http://www.dreamincode.net/code/snippet1543.htm

The process identifier is a property of the process. For example:

Process.Id

All methods available in this process are listed here: http://msdn.microsoft.com/en-us/library/system.diagnostics.process_methods.aspx

+2
source

Source: https://habr.com/ru/post/1714662/


All Articles