Friday, July 13, 2012

Kill all non-windows apps

Ever wanted to kill all running apps except windows ones? Below batch script will do the job..

Save it as kill.bat
@echo off
title Kill all running apps - Bharat Balegere - AgniPulse.com
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" (
echo.
taskkill /f /im "%%i" 
echo.
)
)
)
)
)
pause

Reference: http://www.technibble.com/kill-all-running-apps-bat-repair-tool-of-the-week/

No comments:

Post a Comment