Restarting XBMC via batch file not working on task scheduler
#1
Bumping this again.

I am now trying to use
Code:
C:\Windows\Syswow64\TaskKill /F /IM xbmc.exe
timeout /T 1
ping 192.0.2.2 -n 1 -w 10000 > nul
start "XBMC" "D:\Program Files (x86)\XBMC\XBMC.exe"

When I run this from the command line it works fine, whenever the task scheduler trys to run it it fails. When I XBMC folder in appdata, I see a crashlog of it as well. Any Ideas?
Reply
#2
Should work, perhaps the timeout needs adjustment.

taskkill /f /im XBMC.exe
ping 1.1.1.1 -n 1 -w 3000 > nul
"C:\Program Files (x86)\XBMC\XBMC.exe"

See what that does for you.
Reply
#3
(2013-10-20, 05:39)PatK Wrote: Should work, perhaps the timeout needs adjustment.

...
ping 1.1.1.1 -n 1 -w 3000 > nul
...

See what that does for you.
What is the point of this command? I won't have a windows box here right now, but I assum this runs ping for 3000 ms, or 3 s. What about timeout /t 3. Why introduce ping?

Also the OP said his xbmc.exe is on D: not C:

Better still, can windows test whether an executable is running? In linux I might do something like ps ax|grep [x]bmc to test if xbmc is still running, which is surely the test we want rather than some guesswork time...
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#4
It's the command script I have for a restart and it does work, there was an explanation in the forums for the ping, I suggest you search it up. I'm sure the OP saw the differences between the script and would change the drive letter to fit his circumstances, I'm not custom scripting.

The user is not running Linux (at least I presume, given this is a windows XBMC support forum), glad you can test for a operational executable, windows programmers rely heavily on timed loops, I'm sure there is a way to discriminate but I'm not a script kid.
Reply
#5
If it's stopping XBMC, then the batch file is at least starting and partially running. Which would mean that the scheduler is choking on something in the batch file. Probably the quotes where you restart it.

You can always put a PAUSE at the end of your batch file (ensuring the windows doesn't start minimized or such) and see what error it throws back at you.
HP Stream Mini w/Libreelec -> HDMI -> Toshiba 37"
Intel NUC8i3BEH w/Libreelec -> HDMI -> LG OLED55C3PUA -> S/PDIF -> Sony HT-CT80
Dell Optiplex 7050 Micro w/Libreelec -> HDMI -> Yamaha RX-V467 -> HDMI -> Toshiba 47L7200U
Reply
#6
Bumping this again.

I am now trying to use
Code:
C:\Windows\Syswow64\TaskKill /F /IM xbmc.exe
timeout /T 1
ping 192.0.2.2 -n 1 -w 10000 > nul
start "XBMC" "D:\Program Files (x86)\XBMC\XBMC.exe"

When I run this from the command line it works fine, whenever the task scheduler trys to run it it fails. When I XBMC folder in appdata, I see a crashlog of it as well. Any Ideas?
Reply
#7
You can always put a PAUSE at the end of your batch file (ensuring the windows doesn't start minimized or such) and see what error it throws back at you.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#8
(2014-01-31, 06:59)nickr Wrote: You can always put a PAUSE at the end of your batch file (ensuring the windows doesn't start minimized or such) and see what error it throws back at you.

When the task scheduler runs the bat file, I do not actually see a command prompt window.
Reply
#9
Try this autohotkey script:

Code:
Process, Exist, xbmc.exe ; check if xbmc.exe is running
If (ErrorLevel > 0) ; If it is running
    Process, Close, %ErrorLevel%  ; or use WinClose, ahk_class XBMC
    sleep 3000 ; wait 3 seconds
    run, C:\Program Files\XBMC\XBMC.exe

Install autohotkey, right click desktop or any other location > New > Autohotkey script. Open this file in notepad and paste the above code and save. Right click the file and select compile to get exe file. You can then use taskscheduler to run this script directly or the exe file. In the above code, the process will be force closed. Instead of Process, Close, %ErrorLevel% you can use WinClose, ahk_class XBMC for a normal close.
Reply

Logout Mark Read Team Forum Stats Members Help
Restarting XBMC via batch file not working on task scheduler0