Is it possible to close every application via a batch file?

2.8k views Asked by At

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?

2

There are 2 answers

2
Marged On BEST ANSWER

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 ;-)

2
AudioBubble On

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