首页 > 解决方案 > 在 Node.js 中将文件作为分离进程执行

问题描述

我需要在 node.js 的独立进程中执行一个文件。

这是exe文件的路径: C:\Users\filip\AppData\Roaming/SoulnetworkLauncher/SNLauncherUpdate.exe

我已经尝试过使用 child_process.spawn 但它没有启动(没有触发错误)

const child = cp.spawn("cmd.exe",["C:\Users\filip\AppData\Roaming/SoulnetworkLauncher/SNLauncherUpdate.exe"], {
                        detached: true,
                        stdio: ['ignore']
                    });

child.unref();

并使用 child_process.execFile 但它触发Error: spawn EBUSY

cp.execFile("C:\Users\filip\AppData\Roaming/SoulnetworkLauncher/SNLauncherUpdate.exe")

我应该怎么做?

标签: javascriptnode.js

解决方案


推荐阅读