Node.js 如何在electron js中使用fs.readdirsync()获取exe文件

Node.js 如何在electron js中使用fs.readdirsync()获取exe文件,node.js,electron,fs,Node.js,Electron,Fs,我想获取在electron js桌面应用程序中安装的exe或桌面应用程序的列表。我尝试要求使用“fs”,但它只列出根路径中的文件夹 const fs = require('fs'); const root = fs.readdirSync('/') console.log(root); 如何在Windows上以简单的方式仅获取exe文件。检索列表可能需要一些时间 const { execSync } = require('child_process'); let list = execSyn

我想获取在electron js桌面应用程序中安装的exe或桌面应用程序的列表。我尝试要求使用“fs”,但它只列出根路径中的文件夹

const fs = require('fs');
const root = fs.readdirSync('/')
console.log(root);

如何在Windows上以简单的方式仅获取exe文件。检索列表可能需要一些时间

const { execSync } = require('child_process');

let list = execSync('wmic product get name,version');
console.log(list.toString());

最好的方法是使用N-API编写本机节点模块来完成此操作。

系统中已安装的应用程序或目录中仅存在exe文件?已安装的应用程序。EX gaming ApplicationXeCSync'wmic product get name,version'?我们在这里提供的内容..我想列出windows中的所有exe文件。在您的代码列表中没有显示任何内容。我们可以从此列表启动一些应用程序。。动态使用类execFile