TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Batch file run by trigger behaves differently than run locally?

    Windows
    2
    2
    6
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JoshuaJSlone
      last edited by

      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.exe
      

      When 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.

      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @JoshuaJSlone
        last edited by

        @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 3
        

        I've also added delays with the ping command like this:

        ping 127.0.0.1 -n 2
        

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • First post
          Last post