Tuesday, 1 November 2016

How to kill a task using command prompt in windows?

To kill a task using command prompt follow these steps:

  • Click start button and write cmd
  • Right click cmd.exe and click Run as administrator.
  • Now write:
tasklist /FI "sessionname eq Console"  

List of running tasks will appear.

  • Now write:
taskkill /F /IM <name of task>

For example: To kill all internet explorer processes write:

taskkill /F /IM iexplorer.exe

This will help you to kill one task at a time. If you want to kill all tasks then create a .bat file with following content:

@echo off
title Kill all running apps 
cd c:windowsSystem32
for /f "skip=3 tokens=1" %%i in ('
tasklist /FI "sessionname eq Console"  ') 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"

                                                 )
                                       )
                            )
                 )
        )
)
pause


 Now run the .bat file

No comments:

Post a Comment