Batch file run by trigger behaves differently than run locally?
-
OK, I am extremely new to TRIGGERcmd, and having difficulty with my first trigger. I've set up a simple .bat file in Windows, to kill a program and then restart it. I added a bit of display and short timers so it wouldn't be so instantaneous I'd miss it running, at least for testing purposes. It looks like
ECHO Here we go. TIMEOUT /T 3 taskkill /IM "theprogram.exe" /F TIMEOUT /T 3 theprogram.exeWhen I run it directly from Windows, it behaves as I'd expect.
I set up a trigger with a command like "C:\Program Files\yadayada\restarttheprogram.bat", to be run in the foreground. When I trigger it either from the Windows GUI or from a short link, no window with the messages and timers appears. It does kill the program so it is doing part of what is expected, but then it never restarts the program. I wondered if TRIGGERcmd was lacking permissions, but running it as administrator didn't seem to make a difference.
-
@JoshuaJSlone, that's a known issue with the windows timeout command. It doesn't work in contexts that don't have an interactive terminal, like when running it via TRIGGERcmd. Here's one method that does work:
start /wait timeout 3I've also added delays with the ping command like this:
ping 127.0.0.1 -n 2