zoukankan      html  css  js  c++  java
  • 2012-2-7列举及终止进程

    System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcessesByName("MSACCESS");

                while (ps.Length > 0)          {                 ps[0].Kill();

                     System.Threading.Thread.Sleep(20);

                     ps = System.Diagnostics.Process.GetProcessesByName("MSACCESS");

                 } /////////////             string tempName = "";

                 int begpos;

                 int endpos;

                 foreach (System.Diagnostics.Process thisProc in System.Diagnostics.Process.GetProcesses())             {                 tempName = thisProc.ToString();

                     begpos = tempName.IndexOf("(") + 1;

                     endpos = tempName.IndexOf(")");

                     tempName = tempName.Substring(begpos, endpos - begpos);

                    if (tempName == "MSACCESS")

                     {

                         thisProc.Kill();//当发送关闭窗口命令无效时强行结束进程

                         while (!thisProc.HasExited) System.Threading.Thread.Sleep(10);

                         System.Threading.Thread.Sleep(100);

                     }

                 }

  • 相关阅读:
    IDEA debug时特慢 Method breakpoints may dramatically slow down debugging
    docker构建镜像
    ubuntu 挂载硬盘
    python 的 flask 、django 、tornado 、sanic
    scrapy实战之scrapyrt的使用
    scrapy框架集成http
    python3之Splash
    CentOS7安装PostgreSQL9.6(图文详细操作)
    替代Navicat的数据库操作工具DBeaver
    CentOS 7 安装 Graylog
  • 原文地址:https://www.cnblogs.com/mol1995/p/5965082.html
Copyright © 2011-2022 走看看