const open = require('open')
const main = async () => {
await open('https://google.com', {
app: {
name: 'C:\Program Files\Mozilla Firefox\firefox.exe'
}
});
}
main();
为什么此代码在 W10 上不起作用?将完整路径浏览器 .exe 作为参数传递仅在 Linux 下有效?这就是创作者特别提到WSL的原因吗?
<块引用>您也可以传入应用的完整路径。例如在 WSL 上,这可以 为 /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe Chrome 的 Windows 安装。
来源:temporal