1

I already know that the Taskkill /im command can close a specified application. However, can you kill all applications (just the programs, not the background processes and Windows processes) currently running in Windows (so if I had a lot of programs opened, could I kill them all)?

For example, instead of writing a really long script that kills every single program (on my computer), would I be able to do something in the format of taskkill /all?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Roke
  • 300
  • 1
  • 6
  • 27
  • are you trying to literally kill the system? because not all tasks are killable, and killing some will automatically shutdown/reboot the system. and a user (or even admin) account doesn't have the rights to kill tasks running as `system`. – Marc B Jun 09 '15 at 19:19
  • Nope, just all the .exe programs. Sorry If I was a bit unspecific – Roke Jun 09 '15 at 19:20
  • which would be pretty much everything... – Marc B Jun 09 '15 at 19:24
  • my bad. I'm thinking about the programs that run on the desktop and can be viewed – Roke Jun 09 '15 at 21:36

2 Answers2

2

You could do something like this:

wmic process get caption

This will return the names of running processes. Use those names to taskkill /m them, this should at least kill those processes you opened. For some it might be necessary to /force killing them.

But beware: you might be closing yourself, so perhaps a more elaborate approach is needed which will make sure you don't kill yourself ;-)

Marged
  • 10,577
  • 10
  • 57
  • 99
2

You can add other exe to exclude such as smsss.exe and wininit.exe

wmic process where (caption^<^>'svchost.exe' and caption^<^>'csrss.exe') get /format:list

This terminates all notepads

wmic process where caption='notepad.exe' call terminate
  • For Vista+ you should probably exclude all process from session 0 (Services). It's also a good idea to exclude executables from session 1+ (Console/interactive sessions) that are located in the Windows directory such as winlogon.exe and explorer.exe. For example: `wmic process where "(SessionId!=0 and not ExecutablePath like "%SystemRoot:\=\\%^%")" get Name`. – Eryk Sun Jun 09 '15 at 21:36
  • I suggest that you give a more elaborate explanation, even though I understand it. Just a thought for the future (goes to trigger) – Roke Jun 09 '15 at 21:37