CyberNotes
Tutorial Thursday

Over in the CyberNet forum, Pieter posted an awesome tip for Linux users where you can actually create a shortcut to forcefully terminate an application. This is handy in situations where a program, such as Firefox, freezes up and won’t shutdown. I figured there had to be a way to do this in Windows as well, and so I started searching around.

Almost every site that I found recommended using the taskkill (instructions) command line option, which is rather easy to create a shortcut for since it is built-in to Windows. Doing taskkill /f /im firefox.exe would be the command needed to “forcefully” close Firefox at a moments notice, but I found one flaw with it. Sometimes it is handy being able to forcefully close Firefox even when it’s not frozen, because then you know the next time you start the browser it will ask whether you want to restore your tabs and windows.

What I found with taskkill was that if a program wasn’t frozen it would gracefully close it. That might be nice in some cases, but when you use this with Firefox you won’t get the option to restore your session the next time you start the browser. Don’t worry, I wasn’t about to give up! With the help of a very small (just  6.5KB) free program it will take under a minute to setup.

Note: These instructions are written for Vista, but should be similar in all versions of Windows.

  1. You can download Taskill (note that it is only spelled with one “k”) from the developer’s homepage, but you’ll have to scroll down a ways to find it. Alternatively we are mirroring the file on our server to make it easier to download. Place the file in a location where you’ll easily know the path to it, such as at the root of the “C:\” drive.
  2. The program does have an GUI, but we aren’t going to be using it. Remember, our goal is to create a shortcut that takes advantage of it. Right-click on the Desktop and choose New -> Shortcut.
  3. When it asks for the location you need to type the path to Taskill, followed by the executable’s name that you want to forcefully close. It will look something like this:

    "C:\taskill.exe" firefox.exe

    Where the part in quotes is the location of taskill.exe, and then immediately after that you put the name of the executable program you want to close with the shortcut. Then click the Next button.

    (Click to Enlarge)
    Taskill Create Shortcut

  4. Name the shortcut whatever you would like. In this case we’re going to call it Kill Firefox.

    (Click to Enlarge)
    Taskill Name Shortcut

  5. Now you should have a pretty new icon that you can use to kill all instances of Firefox. You can put this on your desktop, in the Quick Launch bar, or even in the Start Menu.
    Taskill Firefox Shortcut
  6. Extra Credit: You can change the icon of the shortcut by right-clicking on it, selecting Properties, and then click the Change Icon button. While you’re in the Properties you should consider adding a keyboard shortcut if you plan on using it a lot!

This will probably only appeal to a small amount of people, but given the tiny application size and the fast execution I thought Taskill was pretty darn awesome. I use this with my Firefox so that I can shut it down at a moments notice!

There Are 16 Comments

  1. One could also just install TabMixPlus or sessionsaver into Firefox. These (optionally) open your last session automagically.

    TabMixPlus can even be configged to ask if you want to reload your last session.

    Then you can use the MS TaskKill to gracefully close Firefox (if not frozen of course) allowing the saving of anything that may need saving that would get lost in a forceful kill.

  2. Actually there is a good method to kill processes in ubuntu.

    Just add the ‘Force quit’ button to the gnome panel.

    now when an application is misbehaving first press the ‘ Force quit’ Button and then on the window of the application you want to kill.

    Very neat. does the trick :)

  3. Thats useful for when I want to completely shut down my antivirus as well.

    Most antivirus’ by design are not easy to completely shut down the program, but when I want to play a big heavy resource using game I certainly don’t need my antivirus running. But the only way to shut down Avast for example, is to open Task Manager and manually end its three process’.

  4. So is that for Linux or Windows?

  5. Or you can use the Firefox built-in option to restore your tabs and windows every single time.

  6. For windows xp taskkill /F /IM EXCEL.EXE kills the excel process

  7. John Jimenez wrote:
    One could also just install TabMixPlus or sessionsaver into Firefox. These (optionally) open your last session automagically.

    That’s true, but I for one choose not to use that extension because it causes Firefox to use a lot more of my system’s resources.

    xpgeek wrote:
    Most antivirus’ by design are not easy to completely shut down the program, but when I want to play a big heavy resource using game I certainly don’t need my antivirus running. But the only way to shut down Avast for example, is to open Task Manager and manually end its three process’.

    That’s a really good idea as well. Some antivirus applications do offer the exit option, but most don’t (for obvious security reasons). I’ll have to set one up for my antivirus as well.

    netster007x wrote:
    So is that for Linux or Windows?

    It’s for Windows, but Pieter posted a method in the forum to do something similar for Linux.

    Anonymous wrote:
    Or you can use the Firefox built-in option to restore your tabs and windows every single time.

    Ahh, but that just restores your tabs, not windows. It makes sense if you think about it, since by default there is no restart command in Firefox. You’re not able to click on the close button of all your windows at the same time, so it will only remember the tabs from the last window you close.

  8. “Ahh, but that just restores your tabs, not windows. It makes sense if you think about it, since by default there is no restart command in Firefox. You’re not able to click on the close button of all your windows at the same time, so it will only remember the tabs from the last window you close.”

    Wrong, Ryan, in the FF options window, it says “Show my windows and tabs from last time”.

  9. Aha, so maybe Fx’s File>Exit isn’t totally useless after all :)

  10. DKong wrote:
    “Ahh, but that just restores your tabs, not windows. It makes sense if you think about it, since by default there is no restart command in Firefox. You’re not able to click on the close button of all your windows at the same time, so it will only remember the tabs from the last window you close.”

    Wrong, Ryan, in the FF options window, it says “Show my windows and tabs from last time”.

    Okay, netster007x made a good point. I never use File->Exit, but doing that would let you restore your tabs and windows next time. I was thinking along the lines of closing windows using the “X” in the corner, which would make it impossible to restore all of the open windows. Thanks for pointing that out though.

  11. Thanks for posting this. You just saved me about two years on my life of waiting for this thing to shut down.

  12. The easiest way to kill a process in Windows is pskill utility from Sysinternals, which is part of Microsoft now. Just download the utility, store into a folder and add the folder into your system PATH. Then just execute “pskill firefox” in the Run window, and it should do the trick.

  13. If one doesn’t want any shortcut to the ‘taskkill .bat’ files on the desktop, they could save the .bat files on their drives and create a new short cut for the same in the following folder: C:\Documents and Settings\user name\Start Menu\Programs and then right clicking on these shortcuts through the ‘All Programs’ list select Properties and select an F key Keyboard shortcut for the .bat files….Works fast! [provided the taskkill command has taskkill /f /im appname format]

  14. I realize these are old posts, but I just wanted to say Thank You! I’m an assistive technologist working with the blind and physically impaired and you have no idea how many times I’ve needed an easy way to kill a running program. Right now I’m working with someone who is blind and needs to be able to switch between two assistive programs that conflict, and something in his system is blocking the exit cmd for one of the programs. This is the perfect solution, it will save me hours if not days of troubleshooting. Thanks again, and many of my clients will be thanking you as well.

Leave Your Comment


Message is the only required field.
Emails are not published.