Is there a way to run a Windows command line or batch file?
#1
Question 
I'd like XBMC to run a batch file or a windows command. Is there a way to do it? How about is there a way to run a command on exiting the program? Any ideas how to go about it?

Basically, my ultimate goal is to shutdown a remote server with "shutdown \\SERVER /t:00" when I exit XBMC.
Reply
#2
(2013-05-18, 03:02)testmetest Wrote: I'd like XBMC to run a batch file or a windows command. Is there a way to do it? How about is there a way to run a command on exiting the program? Any ideas how to go about it?

Basically, my ultimate goal is to shutdown a remote server with "shutdown \\SERVER /t:00" when I exit XBMC.
You can use Advanced Launcher, create your batch file and create a stand alone launcher like this :
Application : /PATH/TO/YOUR/BATCH/FILE/shutdown.bat
Reply
#3
Thanks, Advanced Launcher works. But - isn't there always a but? Smile - I have to click on Programs > Advanced Launcher > Default > "shutdown.bat" and it will shutdown the remote server.

I was trying to find in the XML's files of the skin exactly how it is calling the shutdown.bat so I can create my own menu option in my skin (so I don't have to go through so many steps, can put it where I want it, etc)

Unfortunately, I can't find it in any of the XML files. I usually go through the XML to find the commands I want to play around with the skins. But I can't find it. Any ideas?
Reply
#4
(2013-05-18, 05:49)testmetest Wrote: Thanks, Advanced Launcher works. But - isn't there always a but? Smile - I have to click on Programs > Advanced Launcher > Default > "shutdown.bat" and it will shutdown the remote server.

no you dont, you can add the launcher you mad to your favorite and then make a menu out of it or a submenu to your shutdown menu depending on what skin your using
Image

If my replies help you, please click on my reputation Image below :) thanks :)
Reply
#5
Once you have created your stand alone launcher pointing to your shutdown.bat file, create a favourite of this launcher. Then you just have to open your xbmc/userdata/favourites.xml file, and copy/paste the link (corresponding to the shutdown.bat favourite) into the <onclick> tag of your skin. For example if your launcher favourite is :

Code:
...
<favourite name="Shutdown" thumb="">PlayMedia("plugin://plugin.program.advanced.launcher/?5b83b7bb3b344e9eb61db1b378073353/38944fb99c3e9279236180949e663b6c/81492ab54b8d39adc352c967e132b612")</favourite>
...

then the corresponding onclick tag will simply be :

Code:
<onclick>PlayMedia("plugin://plugin.program.advanced.launcher/?5b83b7bb3b344e9eb61db1b378073353/38944fb99c3e9279236180949e663b6c/81492ab54b8d39adc352c967e132b612")</onclick>

The other solution, as saitoh183 mentioned, if your skin support it, is to use the favourite as menu or submenu entry into your skin.
Reply
#6
Try this http://forum.xbmc.org/showthread.php?tid=73657. Another option is to create autohotkey that monitors xbmc and then runs the command when xbmc is closed.
Reply
#7
Thanks, I finally am understanding it... months later, but thanks!!!
Reply
#8
i just love how these old threads help me out when in need Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Is there a way to run a Windows command line or batch file?0