(执行 jar 包也是同理)
function executor() {
var exec = require('child_process').exec, child;
// exec_path 写入需要执行的命令
var exec_path = "a.exe";
// 执行函数
child = exec(exec_path, function (error, stdout, stderr) {
if(error) return console.error(error);
// 返回结果封装在 stdout 中,字符串格式
console.log(stdout);
});
}
executor();
(m__m)