Home > Backend Development > C#.Net Tutorial > C# kill background process

C# kill background process

黄舟
Release: 2016-12-27 13:55:13
Original
1846 people have browsed it

var p = Process.GetProcessesByName("WINWORD");
            if (p.Any())
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i].Kill();
                }
            }
            p = Process.GetProcessesByName("EXCEL");
            if (p.Any())
            {
                for (int i = 0; i < p.Length; i++)
                {
                    p[i].Kill();
                }
            }
Copy after login

When I first started, I didn’t know where ProcessName came from. I accidentally saw that the attribute name of the process was like this

As shown in the picture above, if you want to kill any process, just look at the name of the attribute of the process, which is the parameter value of GetProcessByName.

C# kill background process

The above is the content of killing the background process in C#. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Related labels:
c#
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template