Kill all running apps with a double click

I have created a batch file which determines all the process started by the user and terminates all these processes.
It kills only the processes started by the user.These processes includes tray applications and background applications.

Using this batch file you can free up lots of RAM before starting any memory intensive application like Games or Video Encoders.You don’t have terminate each and every application to free up RAM.

This batch file works with both Windows XP and Windows Vista.

NOTE:This batch file cannot kill protected applications like that of Anti-Virus and Firewall

To kill all running apps just download kill.bat and double click on it.

Download it here.


Windows XP

Windows Vista


If you DO NOT want a particular process (example firefox.exe )to be stopped .

Modify the batch file like this.Add an extra line if not “%%i”==”firefox.exe” ( and extra closing bracket )just before the pause.(on the last but one line)

@echo off
title Kill all running apps – Bharat Balegere – AgniPulse.com
cd c:windowsSystem32
for /f “skip=3 tokens=1” %%i in (‘TASKLIST /FI “USERNAME ne NT AUTHORITYSYSTEM”‘) do (
if not “%%i”==”svchost.exe” (
if not “%%i”==”explorer.exe” (
if not “%%i”==”cmd.exe” (
if not “%%i”==”tasklist.exe” (
if not “%%i”==”firefox.exe” (
echo %%i
taskkill /f /im “%%i”



20 Comments + Add Comment

  • when i start bat program, it opens a windows where is written:
    ERROR: impossible to recognise search filter.
    Hit a key to exit
    (it is written in italian language, i translated in english)

    • this batch file should be placed in the startup folder in the documents and settings. It can’t kill anything if it is no started before the naughty bugs start biting. Let me know if this solves the problem.

  • This doesn’t work on XP Home? (SP3) “‘TASKLIST’ is not recognized as an internal or external command, operable program or batch file. Press any key to continue…”

    • It works fine on XP SP3.
      Windows includes tasklist by default.
      Maybe your xp is a customized one which does not have tasklist.

      • I think tasklist is only in the Pro versions. Tested two home versions no tasklist.

      • Yes, it is not included in XP home. Like Kisk said, if you can get those two .exes off a Pro machine, just drop them in the system32 folder on your main drive and it will run from there.

  • So I ran this and now nothing shows on desktop
    its all empty
    how do i get things back?
    reboot?oh got firefox running by alt cont del and then typing in firefox
    to tech for me..an average user. needs more user friendly sstuff, ie idiot proof


    • Looks like you are using a different shell,something other than explorer.exe
      Just add the process name of your shell in the exceptions list.

      • sandbox ie sandboxed web browser?

    • It’s normal. the program will close explorer.exe

      go with shortcut CTRL-ALT-DELETE to start task manager and add explorer.exe in new task.

  • If want to run this on XP home, just download the two files below into the same directory as kill.bat:


  • Hello, i would like to thank this website, i am very, nice working blog. I will probably set a link from my site.

  • Nice Webblog, thanks for all the Info. I will re-visit later looking forward for more fine articles.

  • Great info, thanks for useful article. I am waiting for more

  • Thanks for taking the time to share this, I feel strongly about it and love reading more on this topic. If possible, as you gain knowledge, would you mind updating your blog with more information? It is extremely helpful for me.

  • Nice little script. I’m adapting it.

    XP Home, as said, lacks “taskkill” and “tasklist” but DOES have “tskill”. Any ways to work this into the script, rather than counting on the ability to drop files into Sys32?

  • I like this utility EXCEPT it won’t work with programs with a spaces in them.
    It also closes and will not pause at the end so I put pauses throughout but the last pause doesn’t work.

  • This batch file working perfect but as Chris Robertson mention above. it is not closing those exe files which has spaces or “-” signs.

    Would be much appreciated if anyone will fix this bug.

  • I’ve modified this .bat to support space and the taskkill to kill the processes only the current user. To debug, open the prompt and execute the script into the prompt (example: c:\scripts\kill.bat).

    @echo off
    SETLOCAL EnableDelayedExpansion
    cd c:\Windows\System32
    FOR /F “DELIMS=: TOKENS=2” %%i IN (‘TASKLIST /FI “USERNAME EQ %userdomain%\%username%” /FO LIST ^| FIND /I “Image name: “‘) DO (
    :: Remove space
    SET var=%%~i
    SET MyVar=!var!
    SET MyVar=!MyVar: =!
    :: Process with space in the name
    if “!MyVar!”==”AutomationAnywhere.exe” (
    SET “MyVar=Automation Anywhere.exe”
    :: Applications
    if not “!MyVar!”==”Automation Anywhere.exe” (
    if not “!MyVar!”==”always-on-top.exe” (
    :: Windows Services
    if not “!MyVar!”==”svchost.exe” (
    if not “!MyVar!”==”explorer.exe” (
    if not “!MyVar!”==”cmd.exe” (
    if not “!MyVar!”==”conhost.exe” (
    if not “!MyVar!”==”dllhost.exe” (
    if not “!MyVar!”==”tasklist.exe” (
    if not “!MyVar!”==”vmtoolsd.exe” (
    if not “!MyVar!”==”dwm.exe” (
    if not “!MyVar!”==”taskhostex.exe” (
    if not “!MyVar!”==”rdpclip.exe” (
    if not “!MyVar!”==”find.exe” (
    taskkill /f /im “!MyVar!” /FI “USERNAME EQ %userdomain%\%username%”
    ) ) ) ) ) ) ) ) ) ) ) ) )
    echo Waiting 5 seconds…
    ping -n 5 > nul

  • i made this one that starts “explorer.exe” so you dont have to start it (and it flashes)

    @echo off
    title Kill All Apps
    cd c:\windows\System32
    for /f “skip=3 tokens=1” %%i in (‘TASKLIST /FI “USERNAME eq %userdomain%\%username%” /FI “STATUS eq running”‘) do (
    if not “%%i”==”svchost.exe” (
    if not “%%i”==”explorer.exe” (
    if not “%%i”==”cmd.exe” (
    if not “%%i”==”tasklist.exe” (
    taskkill /f /im “%%i”
    color 0a
    color 0b
    color 0c
    taskkill /f /im “explorer.exe”

Leave a comment