.comment-link {margin-left:.6em;}


.. Hello Earthling .. \o/ :)

Killing All IE Processes
Wednesday, June 03, 2009

During asp.net development its possible that a lot of internet explorer's processes are left running, which you can see from the task manager. This happens when you are starting and closing the browser many times for testing your web application. Some scenerios keep the browsing open and the browser process doesnt shutdown when you close the browser to go back to the debug mode of visual studio (mayeb due to some javascript scripting activities, I noticed because I write a lot of javascript). And I dont restart my computer for days, I only put it to sleep when I am not working on it, so the IE processes just keep on piling up. So sooner or later I have to goto the task manager and kill them all which takes time. So I wrote a little c# code to do this for me, I hope this helps someone else too:

using System;
using System.Collections.Generic;
using System.Text;

using System.Diagnostics;

namespace killIE
  class Program
    static void Main(string[] args)
      if (args.Length > 0)
        if (args[0].ToLower() == "/l" || args[0].ToLower() == "-l")
          new Program(). listprocesses();
        else if (args[0].ToLower() == "/k" || args[0].ToLower() == "-k")
          string goodbyemessage = "Quiting. Have a good day.";
          Console.WriteLine("finding all IE processes ...");
          Process[] ieprocesses = Process.GetProcessesByName("iexplore");
          Console.WriteLine("processes found {0}", ieprocesses.Length);
          if (ieprocesses.Length == 0)
            Console.WriteLine("no one to kill. {0}", goodbyemessage);

          Console.WriteLine("killing them all ...");
          foreach (Process ieproc in ieprocesses)
            Console.WriteLine("killing {0} ..", ieproc.Id);



    void listprocesses()
      Process[] ieprocesses = Process.GetProcessesByName("iexplore");
      foreach (Process p in ieprocesses)



You can pass /l for the list of IE processes and /k to kill all of them.

Comments: Post a Comment

Links to this post:

Create a Link

<< Home


MSDN Blogs
Joel Pobar
Don Syme

Muhammad Ali
Lahore Food Blog

Tech Blog



June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   February 2005   April 2005   June 2005   July 2005   September 2005   October 2005   November 2005   June 2007   December 2007   January 2008   March 2008   April 2008   June 2008   October 2008   February 2009   May 2009   June 2009   July 2009   August 2009   March 2011   June 2011   July 2011   September 2011   October 2011   November 2011   December 2012   May 2013   October 2013   May 2014   March 2015   July 2015   August 2015   December 2015   March 2016   July 2016   October 2016   November 2016  

This page is powered by Blogger. Isn't yours?