External Commands for Windows 7
So I'm trying to setup several external commands and I think I'm missing a step here. I have scripts using powershell and can call them from a batch file. They work when selected in the folder and/or command prompt. I have made an 'extcommand.xml' document in 'C:\ProgramData\Repetier-Server\database'. I can see and select these options in Repetier Server, however nothing happens. I check the log and says 'Starting external command...' with no errors. I'm not sure how to follow the process after this. I'm guessing it's a permission issue since the scripts work and Repetier Server is recognizing the external commands. However, I'm not sure how to grant access to Repetier Server to run these external commands if that's the case. Perhaps it's something else? Anything is welcome.
sample extcommand.xml for reference:
<config>
Thanks
sample extcommand.xml for reference:
<config>
<execute name="NAME" allowParams="true">c:\\FOLDER\\FILE.BAT</execute>
<command>
<name>NAME</name>
<execute>c:\\FOLDER\\FILE.BAT</execute>
<confirm>Really?</confirm>
</command>
</config>
</config>
Thanks
Comments
Do not think it is a permission issue, server under windows has quite high permissions.
Interesting you guys should mention that, I already have a FILE.cmd and have tried to open the command prompt and powershell applications first with a parameter. For some reason I cannot open any applications at all when run through RS. These commands work through Windows command prompt and powershell though. Any thoughts?
c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe "c:\\FOLDER\\FILE.cmd" or "c:\\FOLDER\\FILE.BAT"
Should work.
@execute Cmd2 C:\windows\notepad.exe
@execute Cmd2 "C:\windows\notepad.exe"
@execute Cmd3
None produced any System Errors, but also didn't open any programs.
I'm baffled as to what to try next.
I also found the Run Notepad command was one that I had created in the Console>_ Commands dropdown. Deleted it and it went away from the drop down as expected. The <trash can icon> Delete All text on the Server Logs page is still red and does not delete the logs.
It would be great if there was somewhere I could see the output of the commands and executes being processed.
@execute Exe2 C:\\Windows\\Notepad.exe
did work for me.
Did you restart server or windows after changing the file? It is only read on startup.
I restarted the computer, opened RS >_Console, and pasted your tested command.
Send window: @execute Exe2 C:\\Windows\\Notepad.exe
Response: Send:13:13:28.592: @execute Exe2 C:\\Windows\\Notepad.exe
No System Errors, but Notepad did not appear. I tried it 1st with the printer powered off, and again with the printer on.
Here's some news! I then started Windows Task Manager, and Notepad was shown as Running in there 2 times, both under the Owner user, which is my Windows user name. So Notepad is running, but not visible! In TM I selected the 1st Notepad listing in the Background Processes section, right-clicked, selected Open File Location, it brought me to C:\Windows\notepad.exe as expected, and I double-clicked C:\Windows\notepad.exe and it opened normally. In TM the 3rd running Notepad showed up in the Apps section. I right-clicked Notepad, clicked on Properties, and all the listed Users (Owner is an Administrator) have Read and Execute permissions.
So it looks like on my PC the Command in RS is starting Notepad as a Background Process, not as a App, so it's not visible. Is that right?
So you can start software just not software with gui. But that is actually what it is for anyway. To trigger processes not controllable from server directly that finish after a short while.
https://stackoverflow.com/questions/5307968/how-can-i-run-an-exe-program-from-a-windows-service-using-c
so as long as you start server as service it is not attached to a user and can not open desktop apps resp. they have no desktop to show up. This would only work if you start it within your regular desktop environment as desktop. Just stop the service and go to
C:\Program Files (x86)\Repetier-Server\bin
and start RepetierServer.exe - now they will be started as it is now running in desktop environment. Set service as start never if you want this solution permanently.