要用nodejs执行cmd,需要引入一个包node-cmd
npm install node-cmd
var cmd=require('node-cmd');
cmd.get(
'notepad',//画图板
function(data){
console.log("data")
}
);
cmd.get(
'C:\\Windows\\System32\\Calc.exe', //计算器
function(data){
console.log("cacul")
}
);
cmd.run('touch example.created.file');
// notepad--------打开记事本
//'mspaint' 画图板