C#:判断当前程序是否通过管理员运行
2020-12-13 15:50
阅读:436
标签:style blog http color ar sp div log bs 转载声明:本文转载至http://www.zhoumy.cn/?p=9 C#:判断当前程序是否通过管理员运行 标签:style blog http color ar sp div log bs 原文地址:http://www.cnblogs.com/DoNetCoder/p/4081367.html
public bool IsAdministrator()
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}
评论
亲,登录后才可以留言!