I would like to execute arbitrary command line commands via a LabVIEW web service.
I have a LabVIEW project (attached) with a VI boot.vi that takes a string as an argument, which is handed over to the System Exec VI.
This boot.vi works nicely: when I execute it with a string "test", it nicely executes my Ruby program "test.rb" because (i) I put the path of my the directory inside which test.rb resides into my PATH system variable and (ii) ".rb" endings are associated with Ruby programs on my PC. Similary, I can hand over the string "PATH", and it displays my PATH system variable.
However, if I build and deplay boot.vi as a LabVIEW webservice, the situation looks differently:
- the URL "http://localhost:8080/serviceManager/boot/PATH" works fine: the content of my PATH system variable is correctly displayed in the browser window as expected.
- However, the URL "http://localhost:8080/serviceManager/boot/test" does not work as expected. The following error message (coming Standard Error output of the System Exec VI) is displayed: 'test' is not recognized as an internal or external command,operable program or batch file.
System Exec VI does make correct use of the search paths in the PATH system variable only when NOT executed as part of a web service. This is the case although even in a web service, the content the PATH system variable is KNOWN to the System Exec VI. Strange!
Am I doing something wrong? Or is there a work-around?