SEARCH

How-To Geek

How to Create a Shortcut That Nukes Every Running Windows App

image

Have you ever had dozens of application windows open and wanted to just close them all? There’s a bunch of freeware apps that will close them all for you, but you don’t need extra software—and here’s how to do it.

What we’ll do is use the taskkill command with a bunch of custom arguments that specify to kill everything other than Explorer—but you can really customize it to anything you’d like, and keep in mind you should really read this carefully before proceeding.

Create the Nuke Everything Command

The first thing you’ll want to do is open up a command prompt and then type taskkill /? so you can see the syntax. Loads of options!

sshot-2010-10-21-[12]

We’ll be using a couple of operators to accomplish what we want, including these two:

  • /F – force closes the applications (this is optional, keep in mind force closing will lose unsaved data)
  • /FI – uses a filter, which is where the magic is

The filter command takes a set of arguments, which you can see in the help, but we’ll put them here as well:

Filters:
    Filter Name   Valid Operators           Valid Value(s)
    -----------   ---------------           -------------------------
    STATUS        eq, ne                    RUNNING |
                                            NOT RESPONDING | UNKNOWN
    IMAGENAME     eq, ne                    Image name
    PID           eq, ne, gt, lt, ge, le    PID value
    SESSION       eq, ne, gt, lt, ge, le    Session number.
    CPUTIME       eq, ne, gt, lt, ge, le    CPU time in the format
                                            of hh:mm:ss.
                                            hh - hours,
                                            mm - minutes, ss - seconds
    MEMUSAGE      eq, ne, gt, lt, ge, le    Memory usage in KB
    USERNAME      eq, ne                    User name in [domain\]user
                                            format
    MODULES       eq, ne                    DLL name
    SERVICES      eq, ne                    Service name
    WINDOWTITLE   eq, ne                    Window title

    NOTE
    ----
    1) Wildcard '*' for /IM switch is accepted only when a filter is applied.
    2) Termination of remote processes will always be done forcefully (/F).
    3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote
       machine is specified.

Now that we’ve seen the possible arguments for the filters, it’s time to put them together. For example, if you wanted to kill every app by your username, you’d use taskkill like this to check where your username is “eq” (equal) to geek.

taskkill /F /FI "USERNAME eq geek"

The only problem with this is that it would also kill explorer.exe and dwm.exe, so your whole screen would flash and the Start Menu would completely disappear—probably not what you want. Thankfully we can chain together multiple instances of the /FI argument to fix this problem, and we’ll use the IMAGENAME, which is the name of the executable, and the “ne” for “Not Equal” to the ones we don’t want to kill.

taskkill /F /FI "USERNAME eq geek" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe"

You can customize this even further if you’d like, adding extra processes that you don’t want to close into the list. It’s really up to you—just keep in mind that if you accidentally kill Explorer.exe you can always use Ctrl+Shift+Esc to open Task Manager, and restart the process from the File –> Run menu.

Note: if you don’t want to force kill the applications, you should remove the /F argument.

Create the Nuke Windows Shortcut

Once you’ve got the command figured out, it’s easy enough to create the shortcut—just right-click anywhere and choose New Shortcut. Once you’re there, drop the full command into the location box.

image

Give it an icon and put the shortcut somewhere, and you’re all done. Now you can kill everything in one shortcut, with no added software!

image

In case you’re wondering, you can find this icon in the Windows\System32\imageres.dll file.


Note: use of this shortcut should be done at your own risk, and if your computer explodes don’t blame us. We warned you.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 10/21/10

Comments (24)

  1. Mark

    Nice write up! I really desktop background …where can I get i?

  2. Roland

    How can I chain commands in a similar way? For example, if an application freezes, I want to have a shortcut to force kill that application and then start it again. Can it be done in one shortcut?

  3. Hatryst

    Awesome to be used as a prank ;)

  4. Lady Fitzgerald

    It’s almost as easy to just open the task manager, highlight all the apps, and hit End Task.

  5. pceasies

    @Roland

    Create a new Text Document (.txt file) and change the extension to .bat
    Open it in Notepad and paste:

    taskkill /im firefox.exe /f
    start “C:\Program Files\Mozilla Firefox\firefox.exe”

    That would be an example with Firefox. You can change it to what ever you like.

  6. Kevin P.

    Great shortcut!

    I have a further simplification: Replace the hardcoded username geek above with the Windows environment variable %USERNAME%

    The variable %USERNAME% is set automatically upon runtime and will hold your username. I verified this on my Windows XP system.

  7. Jon

    I just use the Task Manager (Ctrl+Shift+Esc) and end the process. I don’t really want to kill everything.

  8. david

    how can i get this to work in XP? I get an error saying “The file taskkill cannot be found”
    thanks

  9. marvinbek

    I would make a batck file like this:

    @echo off
    cls
    title Task Killer
    :start
    echo Which task do you want to kill?
    set /p kill=
    if not %kill%==explorer.exe goto kill
    if not %kill%==dwm.exe goto kill
    echo You cannot kill explorer.exe or dwm.exe.
    echo Kill another.
    echo.
    echo.
    goto start
    :kill
    taskkill /F %kill%
    echo %kill% is now killed. You can now press a key or close the window.
    pause >nul
    exit

  10. marvinbek

    i cannot test my script, as i currently only have access to aunix shell, but i am confident that it will work.

  11. haxialelite

    RE: marvinbek’s script;

    It does SEEM to do what it is supposed to do, but;
    when I type the process name, it states ( Transparent.exe is the process I want to kill):

    “ERROR: Invalid Argument/Option – Transparent.exe
    Type TASKKILL/? for usage

    and then it states that Transparent.exe is now killed.

    I think this script will work, but needs some adjustment, unless, of course; that is an XP thing. I will try this at home on Vista later.

    Thanks for the post, though, marvinbek. Good Job!

  12. Conan

    I want to alter the code to EXIT only the Following programs\

    Internet Explorer
    Windows Media Player
    Yahoo Instant Messenger
    iTunes

    I have the following code in the desjtop shortcut
    HOWEVER,
    it doesn’t seem to work, please advise

    C:\Windows\System32\taskkill.exe /F /FI “USERNAME eq kudo” /F “IMAGENAME eq YahooMessenger.exe” /F “IMAGENAME eq wmplayer.exe” /F “IMAGENAME eq iexplore.exe” /F “IMAGENAME eq itunes.exe”

  13. Roi

    @Conan
    You can only use /F once

  14. Pippin

    I would appreciate anyone’s thoughts if this could be used to kill malware processes before running a virus/malware scan? I’m always looking for new tools for cleaning up PCs.

  15. Stephen

    @marvinbek
    it is better practice when using variable comparison to surround the variable with characters of some sort
    instead of ‘if not %kill%==explorer.exe goto kill’
    use if not ‘ “%kill%”==”explorer.exe” goto kill ‘

    The reasoning behind this is, if the kill variable is blank or has a space in it, the batch file will throw an error.

  16. Stephen - NYC

    @David,
    I am running Win XP SP3 and I can run the program. I do not know if the command is part of something extra/optional in Windows, though.

  17. skater-andy

    for those who struggle to do this themselves theres a pre-made one!! http://skater-andy.deviantart.com/art/Nuke-Programs-For-Windows-183777052

  18. skater-andy

    Heres one for people who struggle to make it themselves http://skater-andy.deviantart.com/art/Nuke-Programs-For-Windows-183777052

  19. Nick Pull

    ‘taskkill’ is not recognized as an internal or external command, operable program or batch file.

    I am running windows xp sp3. Am I missing something? Excellent tool but I just can;t get it to run. Anyone have any suggestions?

  20. Rick

    Me too, I get the same error message in XP SP3, unable to find ‘taskkill’. So this didn’t work for me.

  21. Ja

    Try using tskill instead of taskkill

  22. Ben

    Hi, thanks so much for this post, it is the best possible shortcut for my work!

    I have a question though; does anyone know how I can add “log off user” when I run the above shortcut??

    I typically have to shut down all programs then click log off, it would be nice if there was a little script I could add to force a log off.

    thanks

  23. edsand

    shutdown /l will do a logofff.

  24. Suljo

    Conan easy fix for you
    taskkill “processname” /f /t
    just open notepad and type
    taskkill “processname” /f /t
    and repeat it as many times u want
    lets say i want to quit skype and steam and notepad and mspaint i will type:

    taskkill notepad.exe /f /t
    taskkill mspaint.exe /f /t
    taskkill skype.exe /f /t
    taskkill steam.exe /f /t

    and save it as quit.bat (.bat must exist!)
    and if i ned to quit it i wolud just run this program
    cheers
    DjHackerr

Enter Your Email Here to Get Access for Free:

Go check your email!