gpt4 book ai didi

c# - 如何在 Windows 中透明地以管理员身份执行任务

转载 作者:行者123 更新时间:2023-11-28 00:50:49 27 4
gpt4 key购买 nike

我想(以编程方式)在某些提升情况下模拟 Windows 的行为。例如,您可以看到无线密码,而无需向管理员确认提升(在无线网络属性 > 显示字符中)。

在这种情况下,没有弹出窗口来请求确认提升。只有一个友好的图标表明该操作需要用户成为管理员。

最佳答案

部分场景没有弹窗的原因是UAC自动提升

这是来自 this article 的摘录由 Mark Russinovich 撰写

The reason that elevation of (most) Windows executables in the two middle settings doesn't result in a prompt is that the system "auto elevates" Windows executables. First, what does Windows define as a Windows executable in this context? The answer depends on several factors, but two things must hold: it must be digitally signed by the Windows publisher, which is the certificate used to sign all code included with Windows (it's not sufficient to be signed by Microsoft, so Microsoft software that's not shipped in Windows isn't included); and it must be located in one of a handful of "secure" directories.

这意味着您的可执行文件必须由 Microsoft 签名,并且必须位于那些“安全”目录中。 Windows 不会自动提升所有内容。

关于c# - 如何在 Windows 中透明地以管理员身份执行任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14176440/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com