英文:
how to get exe files using fs.readdirsync() in electron js
问题
如何仅获取exe文件。
英文:
I want to get the list of exe or desktop application(installed local PC) in electron js desktop application.I tried require('fs') but it list only folder from root path.
const fs = require('fs');
const root = fs.readdirSync('/')
console.log(root);
how to get only exe file
答案1
得分: 1
在Windows上的一个简单方法。可能需要一些时间来检索列表。
const { execSync } = require('child_process');
let list = execSync('wmic product get name,version');
console.log(list.toString());
最好的方法是编写一个使用N-API的本机Node模块来执行此操作。
英文:
A simple way on Windows. Might take some time to retrieve the list.
const { execSync } = require('child_process');
let list = execSync('wmic product get name,version');
console.log(list.toString());
The best way would be writing a native node module using N-API to do this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论