问题
I'm making an application for D-bus in javascript. I need to call an executable from the javascript code and I know that it's possible to do it in Windows like this
var activeXObj = new ActiveXObject("Shell.Application");
activeXObj.ShellExecute("C:\\WINDOWS\\NOTEPAD.EXE", "", "", "open", "1");
But...how to do the same in Linux??
Thanks a lot
P.S: Is not for a browser =)
回答1:
Install node.js (depending on your distro, sudo apt-get install nodejs
) and use the ChildProcess module to execute the program.
Or, get Rhino and use the runCommand command;
来源:https://stackoverflow.com/questions/16607782/how-to-execute-an-executable-from-linux-with-javascript