I found the need to restart a program this week while playing around with a new setup, multiple computers and multiple monitors. I tried to use a program called mouse ShareMouse… and it worked great. However the free version causes you to buy or restart the program every 30 min or so to use the ‘pro’ features. That’s when I thought to just create a restart program script just to see if it would work.
I decided to use batch to script the restart for ShareMouse. I would need to use a loop, timeout, taskkill and start. First I stopped the service when the script started to ensure the loop didn’t fail if the program was already running.
@echo off title SharedMouse Restart Script taskkill /F /IM ShareMouse.exe
Then you enter the loop. I start the program, wait an amount of time less than the program pro version timeout and stop ShareMouse.
:loop echo Starting Application start "" "C:\Program Files (x86)\ShareMouse\ShareMouse.exe" timeout /t 300 echo Stopping Application taskkill /F /IM ShareMouse.exe goto loop
I ran this script on every computer with ShareMouse and it worked fine. I went all day without hiccup. Just thought I’d share this simple restart program script.
If you want to get ShareMouse you can find it here.
Check out my last scripting post here.
Enter your address to subscribe to this blog and receive notifications of new posts!