If you are someone who works on a specific set of applications every time you sit in front of your computer, you might want to open them together with just a single click when you log in to your computer every day. We already have an article detailing how you can save time by opening all the applications together by using a simple batch script.
Just like how you can batch open applications, you can batch close applications as well. For this purpose, we need to write a simple batch script that needs no coding knowledge. Read on, to learn how you can easily close multiple programs instantly in one go.
Section 1: How to Create and Execute the Batch Script to Close Multiple Programs at Once
Step 1: Go to the Desktop instantly by pressing the WIN + D keys together.
Once at the Desktop, right click on empty space, click on New and then click on text Document.
Step 2: Now double click on the text document that you just created, to open it.
Step 3: As next, in the text document, copy and paste the following command.
taskkill /F /IM <imageName> /T > nul
Please note that you have to replace <imageName> with the Image Name of the application that you want to close. You can refer to Section 3: How to Find the Image Name of the Process / Application to be Closed, if you don’t know the Image Name of the process that you want to kill.
The command parameters are explained below:
taskkill – To kill the process or the application.
/F – To forcefully terminate the running process.
/IM – Stands for Image Name. /IM is followed by the process’s Image Name. If you don’t know the Image Name of the process that you want to kill, please refer to Section 3: How to Find the Image Name of the Process / Application to be Closed.
/T – To terminate all the children of the process.
nul – To suppress the errors and messages.
You can add as many lines as you want. Each line would correspond to a single application or program.
Finally, at the end write @pause. This is for you to see the results of your command executions. For example, if a program couldn’t be closed, then you will be able to see the reason why it couldn’t be closed, on the CMD screen. Otherwise, the CMD screen would close in a flash.
An example script, where we are closing the programs Notepad, Calculator and WPS office, using our batch script, is shown below.
taskkill /F /IM Notepad.exe /T > nul taskkill /F /IM CalculatorApp.exe /T > nul taskkill /F /IM wps.exe /T > nul @pause
Once you are all done, do not forget to hit the keys CTRL + S together to save the file.
Step 4: Now get back to Desktop, click on the file and press the F2 key to rename the file.
Step 5: You can give any name to your file, we have named it as Close Multiple Programs. Whatever name you give, make sure you give the extension of the file as bat after the . (dot). This is the most important part.
Step 6: Once you have entered the name, click somewhere else on the screen. You will now get the following Rename confirmation window. Press the Yes button to confirm.
Step 7: That’s it. Your batch script file is now ready. Double click on it to execute it.
Step 8: Your batch script would now close all the programs specified in it.
Also, you will be able to see which all programs got closed on the Command Prompt screen. This is because you put the @pause command at the end of your script. This pauses the screen and waits for a keypress before it closes the command prompt screen.
Section 2: How to Add More Programs to the Existing Batch Script
If you would like to add more programs to the list of programs that you want to be closed in your batch file, you can very well do so.
Step 1: Right click on the batch file you created and click on Show more options.
Step 2: From the menu that expands out, click on the Edit option.
Step 3: Now, the batch script would open in Notepad, where you can make modifications as usual.
In the example below, we have added one more line to our script. This time, we are aiming to kill MS Paint as well.
Section 3: How to Find the Image Name of the Process / Application to be Closed
This section is more like an appendix that will help you find the Image Name of an application or process.
To kill an application, you either need its Image Name or its process ID. For some applications, the Image Name could be straightforward, but for some other applications, this cannot be guessed straight away. In such cases, you can follow the steps below to easily find out the Image Name of the process that you want to kill.
Step 1: On the taskbar located at the bottom line of your Windows screen, click on the lens icon.
Step 2: On the Search bar, search for cmd and click on Run as administrator option to open Command Prompt in elevated mode.
Step 3: When the Command Prompt launches open, copy and paste or type in the following command to list out all the running processes on your computer.
Once you have the list, under the column Image Name, you can scroll and find out the name of the process/application that you want to kill. And you can use this Image Name in the taskkill command.
That’s it. Hope you will be saving a lot of time from now on, using this super cool trick.
Please tell us in the comments section whether you found the article useful. Also, if you are stuck at any of the steps, let us know, we are happy to help.
Here to enlighten, and to be enlightened, with the amazing world of tricks, tips, how-tos, and hacks.