loadrunner agent 中删除失效的mmdrv进程

时间:2022-06-29 21:22:34

 源码:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kill_mmdrv
{
    class Program
    {
        static void Main(string[] args)
        {
            KillProcessesByName("mmdrv");

        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="processName"></param>
        private static void KillProcessesByName(string processName)
        {

            Process[] processes = Process.GetProcessesByName(processName);  // 获取程序名为processName的所有进程
            )
            {
                foreach (var process in processes)
                {
                    if (!process.HasExited)
                    {
                        process.Kill();
                    }
                }
            }
        }

    }
}

下载地址:

http://files.cnblogs.com/files/dehai/kill_mmdrv.rar