如何批量關(guān)閉系統(tǒng)進(jìn)程

字號:


    //如何批量關(guān)閉某一進(jìn)程,用以下代碼可以實(shí)現(xiàn)(ps:以下是.net代碼實(shí)現(xiàn)關(guān)閉php-cgi.exe進(jìn)程的方法)
    try
    {
    int num = 0;
    process[] ps = process.getprocesses();
    foreach (process item in ps)
    {
    if (item.processname == php-cgi)
    {
    if (num > 0)
    {
    item.kill();
    }
    num++;
    }
    }
    }
    catch { }