C#强制结束某指定进程方法
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- Process[] processes = Process.GetProcesses();
- foreach (Process p in processes)
- {
- if (p.ProcessName == "nginxd") //若要同时结束多个不同进程,那么在if中假如判断即可,
- {
- p.Kill();
- }
- }
- }
- catch (Exception)
- {
- }
- }
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论