问题描述
启动项目:
node app.js
在app.js中,如何让node去打开当前系统中已经安装的atom编辑器?
在npm中找到一个包,是可以打开指定浏览器,还是不能打开指定应用程序
//自动打开chrome浏览器var opn=require(’opn’);opn(’http://localhost:8080’, {app: ’chrome’});
问题解答
回答1:var exec = require(’child_process’).execFile;var fun =function(){ console.log('fun() start'); exec(’atom.exe’, function(err, data) { console.log(err)console.log(data.toString()); }); }fun();
https://nodejs.org/api/child_...