如何知道node-webkit应用程序是否以管理员/提升的权限运行? [英] How to know if node-webkit app is running with Administrator/elevated privilege?
本文介绍了如何知道node-webkit应用程序是否以管理员/提升的权限运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何确定node-webkit是否在Windows上以管理员权限运行?
How to determine if node-webkit is running with administrator privilege on Windows?
推荐答案
On windows, you can use the npm package is-admin, to check if the node process is elevated.
const isAdmin = require('is-admin');
isAdmin().then(elevated => {
if (elevated) {
console.log('Elevated');
} else {
console.log('Not elevated');
}
});
还有一个名为 is-elevated 的跨平台实现,它捆绑了Unix的海拔检查和Windows
There is also a cross platform implementation called is-elevated which bundles elevation checks for Unix and Windows
这篇关于如何知道node-webkit应用程序是否以管理员/提升的权限运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文