在电子窗口内运行非电子可执行文件 [英] Run a non electron executable inside electron window
本文介绍了在电子窗口内运行非电子可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Electron的新手,我想在我的主窗口中运行一个非电子可执行文件.可以这样做吗?
I'm new to Electron and I'd like to run a non electron executable inside my main window. Is it possible to do that?
这是我的代码:
mainWindow = new BrowserWindow({width: 860, height: 645})
mainWindow.loadURL('https://url.com/')
const { execFile } = require('child_process');
const child = execFile('C:\\test\\content.exe', {cwd: 'C:\\test\\'}, (error, stdout, stderr) => {
if (error) {
throw error;
}
console.log(stdout);
});
谢谢.
推荐答案
我认为您在正确的轨道上,但您需要这样做:
I think you're on the right track except you need to do:
const { execFile } = require('child_process').execFile;
代替:
const { execFile } = require('child_process');
execFile
docs here.
这篇关于在电子窗口内运行非电子可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文