Stop a Group of Processes

gbertoli3 0 Tallied Votes 126 Views Share

Stop a Group of Processes

/// <summary>
        /// Stops a group of processes.
        /// </summary>
        /// <param name="Processes">The group to stop.</param>
        public static void StopGroup(String[] Processes)
        {
            for (int i = 0; i < Processes.Length; i++)
            {
                foreach (System.Diagnostics.Process process in System.Diagnostics.Process.GetProcesses())
                {
                    if (process.ProcessName.ToLower() == Processes[i].ToLower())
                    {
                        process.Kill();
                    }
                }
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.