Extcommands on Windows

edited March 2018 in Questions & Answers
Hi all,

I just tried to run external commands on windows with no luck.

This is what I  tried:

extcommands.xml:

<config>
<!--
If you want to run external commands, enter them in this configuration with
full path. You will see them in the main menu. Copy this file into the
<storage>/database directory.

Security consideration: The reason there is no online editor for this is simply
security. The commands you enter here are executed with the privileges of the
daemon running the server. If you would allow online configuration, a hacker could
simply add any command he needs to hack your system.

Commands are normally visible in the global menu. If you want one to appear only in
in the printer menu, add the attribute "slugname" to command. You see the slugname
when you select a printer as part of the path.
-->
<command>
<name>run notepad</name>
<execute>notepad</execute>
<confirm>Really run notepad?</confirm>
</command>

<command>
<name>run c:\windows\notepad.exe</name>
<execute>c:\windows\notepad.exe</execute>
<confirm>Really run c:\windows\notepad.exe?</confirm>
</command>

<command>
<name>run c:\\windows\\notepad.exe</name>
<execute>c:\\windows\\notepad.exe</execute>
<confirm>Really run c:\\windows\\notepad.exe?</confirm>
</command>

<!--
G-code files can contain
@execute cmd param1 param2
commands. To prevent external users from executing unwanted or dangerous commands,
only commands defined here are allowed to execute. More over, only the shortcuts
defined here are to be used as cmd in @execute. Prevent parameter where ever possible.
-->

</config>

All are recognized, so I can see them:


But you guess it, nothing happens if click on them. It's an old Windows XP machine, but that should not matter.

What am I doing wrong? Even the third one looks as it should work, as  I get this from the logs:

2018-03-09 09:46:31: Starting external command notepad with 0 parameters.
2018-03-09 09:46:34: Starting external command c:windowsnotepad.exe with 0 parameters.
2018-03-09 09:46:34: Handling action 'runExternalCommand' caused error System exception
2018-03-09 09:46:38: Starting external command c:\windows\notepad.exe with 0 parameters.

Stefan


Comments

  • ok, I got it to run, starting notepad.exe was only ment for testing, it does not work. But now I can run PHP scripts, i.e. to send me Pushover Messages on certain events. This is the code I used:
    	<execute name="PushoverMessage" allowParams="true">c:\\php5\\php.exe c:\\skripte\\Repetier-Server\\pushover.php</execute>

    <command>
    <name>Send PushoverMessage</name>
    <execute>c:\\php5\\php.exe c:\\skripte\\Repetier-Server\\pushover.php</execute>
    </command>

    Both variations work for me now, so a command to send me a message on a finished print could look like this:

    @execute PushoverMessage "print finished"

    Stefan


Sign In or Register to comment.