[英]Run a Batch File OnClick of Button from DOM in Node-Webkit App
I cannot seam to figure this out please help me run "run.cmd" onclick of button from my nwjs application. 我无法弄清楚,请帮助我从nwjs应用程序中单击按钮运行“ run.cmd”。
<button onclick="runHelperProcess()">Run Process</button>
. 。
<script type="text/javascript">
function runHelperProcess() {
gui.Shell.openItem('run.cmd');
}
</script>
run.cmd is located in the root dir of the nw application. run.cmd位于nw应用程序的根目录中。
Try this: 尝试这个:
<button onclick="require('child_process').spawn('YourBat.bat'),[]);">Run Process</button>
NB: It assumes the batch file is in the same directory as your app. 注意:假定批处理文件与您的应用程序位于同一目录中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.