How to Create a Shortcut That Nukes Every Running Windows App

By Lowell Heddings on October 21st, 2010

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
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!