Search code examples
batch-filecmdtaskkill

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


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?


Solution

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