A couple of weeks we wrote up a tutorial on how to create a single batch file that would simultaneously launch several different applications. It’s a handy little trick that many people found useful because they are frequently running the same programs on their computer. For example, when you start your computer you might open a browser, media player, and document editor. Instead of clicking on each of those shortcuts individually you can create a single batch file that will do the dirty work.
In the comments of that article “ExitRitual” asked a great question. He was wondering if it would be possible to do the same thing, but for closing programs. This would come in handy if, for example, you were getting ready to play a computer game. Most people shutdown a majority of the running applications to ensure that the game runs smoothly, and it can all be done in a single batch file.
We’ve shown how to do something similar in the past, but we were using a free third-party program because it was a little more powerful for the task at hand. This time around we’re going to use a command line option that is built-in to Windows.
–Instructions–
- Open Notepad (Start Menu -> Accessories -> Notepad):

- Now you need to find the filename of the programs you want to close. I believe the best way to do this is to open up the Task Manager. Do this by right-clicking on the Taskbar and choosing the Task Manager option. Then look for the filename of the program you want to close.
- Now you’ll need to use the taskkill command in Notepad, along with the filename(s) that you just grabbed in the previous step. Each command will look like this:
taskkill /im firefox.exe
Where firefox.exe is the filename of the program you want to close. Put each of these commands on a separate line like this:
- Save it as a .BAT file by manually entering in the extension at the end of the file name.
- Double-click on the new file that you just created to test out the results. Each program listed will be closed in a friendly fashion instead of being shutdown forcefully.
The batch file will be smart enough to skip over any applications that are currently not running. So throw all of those extra programs in the batch file, and don’t forget to include things that might be running the the System Tray.
This is just one of the hundreds of CyberNotes we have done. You can find more of them by visiting our CyberNotes category, or by subscribing to our CyberNotes feed. We also have a full feed available if you want to receive all of our articles in your reader!
Tags: CyberNotes, Software, Windows, Applications, How To, Tips And Tricks


Related Posts:
- Your Week in Review with Sunday’s Summary
- CyberNotes: Create a Shortcut to Launch Multiple Programs
- Your Week in Review with Sunday’s Summary
- CyberNotes: Shortcuts to End Processes and Programs
- CyberNotes: Shortcut to Change Resolutions





















After that article where i asked about closing applications,i went on a bit of a hunt, and found pretty much the above, but i also found that adding ” /f” to the end of each line can also forcibly close an application. Not essential, but quite handy.
One odd side-effect i’ve found in using a batch file to launch applications (specifically those that sit in the system tray) is that it resets the hide/show options for the icon, not a major annoyance, but mildly confusing none-the-less…
Using a batch file to close applications really does help quite a lot, as you say, when preparing to play games, it can really give you that little bit extra back to use. Very handy indeed ^_^
…Now i just need to figure out how to add a theme change to that batch file (to swap between full-on Aero, and windows classic, thus saving a lot of ram).. one step at a time, i suppose..
Anyway, thanks for posting the original article, until then i had NO idea such a thing was possible, and it’s saved me a notible amount of time and hassle
It’s odd, but it works erratically on my PC. And I can’t put my finger on it why… somtimes it does work, sometimes it doesn’t, then I thought it had to do with capitals in the program names but then again it does close ADC.exe but it doesn’t close Wakoopa.exe… I’ll fiddle with it some more. Would be just *great* if this wanted to work properly
First of all, forgive me for living up to Linux hippie cliché.
In Linux, we’d just do this in a terminal:
killall calc && killall firefox && killall googletalk
One command and you’re all done. You’re just a few more click away from making it a script that you can use over and over.
Is there any way It could shutdown a list of processes after a certain period of windows inactivity?
SlowMotion,
You would need to develop a program that detects for Windows activity. This can be done using the Win32API, using SystemParameters.
Then you could call on this batch file once the conditions have been met.
really neat
The “&&” seems to work in windows too… (As much as I loathe to give MS an inch.)
Just for you to know,
And if there need to save documents, it’s doesn’t pop the box that ask for (excel 2000).
It doesn’t close firefox 3 beta 2 on XP.
Please let me know how to do it.
That’s what we love to hear! There’s nothing like knowing that we’ve saved people some time.
You can try using the /f switch on the line where you specify the program’s filename. As ExitRitual pointed out that will force a program to close, but you might want to be careful with how you use that. If you’re not careful you could end up losing a document or something if it hasn’t been saved.
It would be rather easy to make an application that did that, but I don’t think it can be done in a batch file.
I have no troubles closing the latest Firefox 3 nightly builds, so maybe for some reason there is a bug with it.
Does this not work on Win2K? In the command window I get the message:
“taskkill” is not recognized as an internal or external command, operable program or batch file.
for every line that I’ve put into the batch file.
Much easier: Click the programs in the taskbar > right-click and Close Group
http://unlockforus.blogspot.co.....-time.html
I think Windows 2000 users need to use the “kill” command, which works similarly.
That’s true, but it doesn’t work for apps running in the System Tray.
Hello, from the moment I use Vista 32bits I lost “SmartClose”
and I found this batch file so helpfull for me, but I have some problems with the programs in the system tray, many programs in there, before to close require a confirmation. :/
I used /f without good result
Any one here have any tip to close these programs using another command in the batch file?
Thanks for your help (specially Ryan for this tool).
God bless you, bye.
The /f will only work if the program isn’t responding. You might be able to use something like this in the batch file:
http://cybernetnews.com/2007/1.....-programs/
Hi All,
We use taskkill to stop any process, what is the command to start any process.
Thanks
Sanjay
With respect to programatically shutting down aero.. I believe:
net stop “…”
where … is the name of the Aero service (”Display” something or other) will do it.