While you work in Windows machine, sometimes too many instances of the same task gets started by mistake or triggered by virus etc and TOO many windows will be opened. Now how to kill all of them without the pain of clicking "Close" button several times. Easy way is to use a command: taskkill. To get started, use tasklist command - to see the list of task running currently. This command output is similar to TaskManager window (or in similar spirit to Unix/GNU Linux ps command). This command will list all the task as below (output from my machine). Just for Demo I have created several instances of gvim to run (that can be seen in below output). Now to kill all of them at once, use:
taskkill /IM IMAGENAME.
In this example it is: taskkill /IM gvim.exe. This will kill all instances of gim.exe (as shown below).
Demo on MS-DOS prompt:
C:\>tasklist
Image Name PID Session Name Session# Mem Usage
========================= ====== ================ ======== ============
System Idle Process 0 RDP-Tcp#40 0 28 K
System 4 RDP-Tcp#40 0 68 K
...
cmd.exe 2412 RDP-Tcp#40 0 1,316 K
notepad.exe 912 RDP-Tcp#40 0 3,284 K
gvim.exe 2024 RDP-Tcp#40 0 3,168 K
gvim.exe 756 RDP-Tcp#40 0 7,028 K
gvim.exe 2132 RDP-Tcp#40 0 6,352 K
gvim.exe 3872 RDP-Tcp#40 0 6,368 K
gvim.exe 2136 RDP-Tcp#40 0 6,388 K
gvim.exe 620 RDP-Tcp#40 0 6,404 K
gvim.exe 3856 RDP-Tcp#40 0 6,408 K
gvim.exe 2708 RDP-Tcp#40 0 6,392 K
gvim.exe 2092 RDP-Tcp#40 0 6,424 K
gvim.exe 3616 RDP-Tcp#40 0 6,368 K
gvim.exe 3292 RDP-Tcp#40 0 6,384 K
tasklist.exe 1832 RDP-Tcp#40 0 4,568 K
C:\>taskkill /IM gvim.exe
SUCCESS: The process "gvim.exe" with PID 2024 has been terminated.
SUCCESS: The process "gvim.exe" with PID 756 has been terminated.
SUCCESS: The process "gvim.exe" with PID 2132 has been terminated.
SUCCESS: The process "gvim.exe" with PID 3872 has been terminated.
SUCCESS: The process "gvim.exe" with PID 2136 has been terminated.
SUCCESS: The process "gvim.exe" with PID 620 has been terminated.
SUCCESS: The process "gvim.exe" with PID 3856 has been terminated.
SUCCESS: The process "gvim.exe" with PID 2708 has been terminated.
SUCCESS: The process "gvim.exe" with PID 2092 has been terminated.
SUCCESS: The process "gvim.exe" with PID 3616 has been terminated.
SUCCESS: The process "gvim.exe" with PID 3292 has been terminated.
C:\>
No comments:
Post a Comment