In a command file, startup.cmd, I have something like
start "program.exe"
I would like to do the following:
if running, stop program.exe
start program.exe
I tried
taskkill program.exe
If the process is not running though, I get an error - and I don't want to get errors... Not sure if this is not too violent a kill, either.
How can I stop my program if it is running, before starting it ? (if it starts while another instance of itself is running, results may be unpredictable...)
(Windows)