要用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' 画图板 

 

  

相关文章:

  • 2021-07-27
  • 2021-06-05
  • 2022-03-03
  • 2021-11-28
  • 2022-01-18
  • 2021-09-18
猜你喜欢
  • 2021-07-14
  • 2021-06-22
  • 2021-07-01
  • 2021-05-18
  • 2021-07-29
  • 2021-12-06
  • 2021-09-10
相关资源
相似解决方案