Batch (bat) file to close and restart automatically a program or process
You may need sometimes to close a process that is not working as expected, and then restart it. To do that manually you can open the Task Manager, search for the process, press the “End Task” button, wait for Windows to terminate the process, then close the Task Manager, go to Start Menu, find the program and restart it…. It is easy to understand how useful a batch file can be in such occasions, since it will let you do all of this with a single click of your mouse or a keyboard shortcut.
To create a batch file that will close and immediately restart a process we need CloseApp, Sleep and a simple text Notepad. We create actually two batch files, the first one to close the process or program and the second to start it again. The first batch file will also run the second. We need two batch files instead of just one, in order to make sure that the program / process is indeed closed before we attempt to start it again.
Here is an example, how you can terminate and restart the itype (IntelliType) process:
Open your Notepad, paste the following lines, and save the file as “somename.bat”:
@echo off start " " "C:\Program Files\closeapp\itype.lnk" start /wait "" "C:\Program Files\sleep\Sleep.exe" 3 start " " "C:\my documents\mybats\somename2.bat" exit
The first line uses CloseApp to send a termination command for the IntelliType process, the second line uses Sleep to give 3 seconds to Windows to close the process, and the third line opens the next batch file: on a blank page of the Notepad paste these lines, and save the file as “somename2.bat”:
@echo off start /wait "" "C:\Program Files\sleep\Sleep.exe" 2 start " " "C:\Program Files\Microsoft IntelliType Pro\itype.exe" exit
The first line gives some more time to Windows, 2 seconds, and the next line orders Windows to start the IntelliType application.
You should change the paths above according to your installations. The itype.lnk file is a shortcut to CloseApp.exe you can create inside or outside the CloseApp folder, to terminate the itype process. Here is the target of the shortcut:
"C:\Program Files\closeapp\CloseApp.exe" itype.exe
Again, you should change this according to the process you need to close.
Finally, create a shortcut in your StartMenu to run the first batch file; you can assign a keyboard shortcut to it, or you can add it to the favorite Launcher of yours (if you use one). — Enjoy!

