html - Node Webkit - 如何执行 exe 文件?

标签 html node.js node-webkit

我正在使用 Node Webkit 组件来包装我的 html5 应用程序。 在此应用程序中,我需要运行 CMD 或其他 (exe) 文件,如“customApplication.exe”并传递一些参数。

我对这件事真的很绝望。如果你能帮助我,我会很高兴。这非常重要,我不想更改我的组件并使用 Awesomium 或其他组件。

非常感谢您。

最佳答案

希望此示例代码对您有所帮助。 (它摘 self 最近对 ​​node-webkit 的电子书介绍。) 您需要将变量“filePath”设置为“customApplication.exe”的完整路径

 var execFile = require 
    ('child_process').execFile, child;

 child = execFile(filePath,
       function(error,stdout,stderr) { 
    if (error) {
      console.log(error.stack); 
      console.log('Error code: '+ error.code); 
      console.log('Signal received: '+ 
             error.signal);
      } 
    console.log('Child Process stdout: '+ stdout);
    console.log('Child Process stderr: '+ stderr);
  }); 
  child.on('exit', function (code) { 
    console.log('Child process exited '+
        'with exit code '+ code);
  });

祝你好运

乔纳森·多德

“使用 node-webkit 创建 Windows 桌面应用程序”

关于html - Node Webkit - 如何执行 exe 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18183882/

相关文章:

javascript - 拆分 HTML 表格以适合视口(viewport)宽度

html - 带有 x 滚动的 CSS 绝对位置

angularjs - 在快速服务器上成功调用 api 后重定向具有 Angular 路由的页面

mysql - 如何访问 RowDataPacket 对象

javascript - NWjs : Chat head click not working if -webkit-app-region: drag is set

javascript - Node.js:WAITING异步调用的响应

html - 嵌套表单在 HTML5 中有效吗?

javascript - 为单个父单击显示/隐藏多个子类(Jquery)

node.js - 使用 httpclients axios 和 request-promise 在 node/express js 中读取响应 HEADER 时大写转换为小写

javascript - 如何使用 node-csv 将标题行添加到 CSV 文件?