Hello all,
I tried to execute a windows command with proc:execute().
See my module: ———
module namespace _ ='process';
declare %rest:path('treez/proc') function _:process() { prof:dump( proc:execute('C:\Program Files\Microsoft Office 15\root\office15\winword.exe','/q') ) };
declare %rest:path('treez/proc_dir') function _:process2() { proc:execute('dir','\’)
———— While function process() works as expected and opens winword, the function process2() (example from the docs) leads to following error:
<result> <error> Cannot run program "dir": CreateProcess error=2, Das System kann die angegebene Datei nicht finden </error> </result>
Any hints? As process() works and opens winword, I prosume that the error does not come from my installation (Win10, Tomcat 9.0, BaseX 9 - war version). Starting Tomcat as admin does not change anything.
Best,
Dieter Zanzinger Finanzgericht München
Any hints? As process() works and opens winword, I prosume that the error does not come from my installation (Win10, Tomcat 9.0, BaseX 9 - war version). Starting Tomcat as admin does not change anything.
Just guessing: Maybe Tomcat servlets are run in a restricted environment? I just tried your example code with Jetty, and 'dir' was executed as expected. Could you try to launch 'basexhttp' and check if 'dir' yields any results?
Thanks in advance, Christian
PS: If you want to access files and directories with BaseX, the XQuery File Module is probably the best choice.
basex-talk@mailman.uni-konstanz.de