持续UAC升高

发布于 2024-12-26 14:27:10 字数 111 浏览 2 评论 0原文

有什么方法可以使程序 UAC 在新实例中永久提升。我有一个在 UAC 提升模式下运行的程序,需要在 UAC 提升模式下启动一个进程,但用户不会每次都在计算机上进行授权。也许在安装过程中......但不是每次。

Is there any way that I can make a programs UAC elevation permanent across new instances. I have a program that runs in UAC elevated mode that needs to launch a process in UAC elevated mode but the user will not be at the computer to authorize each time. Maybe during installation ... but not each time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

阳光下的泡沫是彩色的 2025-01-02 14:27:10

从提升的进程生成的进程已经被提升。您无需执行任何操作即可实现该功能。

尝试一下:

  1. 启动提升的 cmd.exe
  2. 从命令提示符运行 notepad.exe。记事本将被提升,因为它是从提升的命令提示符启动的。
  3. 使用记事本编辑文件,例如HOSTS文件(我经常这样做);这需要提升权限。

A process spawned from an elevated process will already be elevated. There is nothing you need to do to make that work.

Try it:

  1. Start cmd.exe elevated.
  2. Run notepad.exe from the command prompt. Notepad will be elevated because it started from an elevated command prompt.
  3. Use Notepad to edit a file, such as the HOSTS file (something I frequently do); which would require elevated permissions.
塔塔猫 2025-01-02 14:27:10

你可以完全禁用UAC。

更理想的做法是将以下行添加到应用程序的清单文件中:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

正如 vcsjones 已经指出的那样,提升的进程将产生提升的进程,并且通过要求您的程序运行其中一个,您可以确定事情会顺利进行,而无需用户必须一直在那里。

You could just disable UAC completely.

Something more .. desirable is just adding the following line to your application's manifest file:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

As vcsjones already pointed out, an elevated process wil spawn elevated proceses, and by requiring your program to run of one, you can be certain things will go alright without the user having to be there all the time.

℉絮湮 2025-01-02 14:27:10

不。如果您可以,那么每个人都会,那么UAC的整个目的就会落空。

No. If you could, then everyone would, and then the entire purpose of UAC would be defeated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文