[C#]判断当前进程/线程是否运行在管理员身份下 Leave a reply C#里判断当前进程/线程是否运行在管理员身份下 WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); bool isRunningElevated = principal.IsInRole(WindowsBuiltInRole.Administrator);