当前位置:编程学习 > C#/ASP.NET >>

C# 关闭进程

private void KillProcess(string processName)
    {
        //获得进程对象,以用来操作  
        System.Diagnostics.Process myproc = new System.Diagnostics.Process();
        //得到所有打开的进程   
        try
        {
            //获得需要杀死的进程名  
            foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcessesByName(processName))
            {
                //立即杀死进程   www.zzzyk.com
                thisproc.Kill();
            }
        }
        catch (Exception Exc)
        {
            throw new Exception("", Exc);
        }
    }

摘自 朱金拖的专栏
 

补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,