CMD

Restart program with Windows command line

restart with Windows CMD

Here is an easy way to restart a program with the Windows command line by using the Windows command script. In this situation, I will create a script to restart Outlook minimized. There might be other specific needs, and some of them are in this post.

Restart program with Windows command line in 2 steps

  1. Use command taskkill to close the program by using the image name of the process to be terminated. Here is another example of how to close Excel with the Windows command line.
  2. Use command start to open the program and minimized if necessary. Here are is more about running minimized.
taskkill /f /im outlook.exe

start /min outlook.exe

 

What’s next?

You can put those two lines of code in a batch or cmd file and schedule with Windows Scheduler.

If you would like to loop that, you can do this with the help of a Windows command script. Also, you can run Window command scripts conditionally inside a batch file.

If you are working with Windows batch files then it is a good idea to run them minimized. Nothing can be more annoying than a window popping up in situations where you don’t want it.

Another tool is Autologon that might be useful after Windows restart to log in user automatically. This and other tools from Microsoft Sysinternals utilities might be very helpful with various automation and other tasks.




0 comments on “Restart program with Windows command line

Leave a Reply

Your email address will not be published. Required fields are marked *