We can use using System.Diagnostics namespace using C#.
public static void CloseAllBrowsers()
{
List<string> browserList = new List<string>() { "iexplore", "chrome", "firefox" };
Process[] process = Process.GetProcesses().Where(x => browserList.Contains(x.ProcessName))
.ToArray();
foreach (Process proc in process)
{
proc.Kill();
while (!proc.HasExited) { }
}
}
public static void CloseAllBrowsers()
{
List<string> browserList = new List<string>() { "iexplore", "chrome", "firefox" };
Process[] process = Process.GetProcesses().Where(x => browserList.Contains(x.ProcessName))
.ToArray();
foreach (Process proc in process)
{
proc.Kill();
while (!proc.HasExited) { }
}
}
No comments:
Post a Comment