Can I stop an executable from requesting UAC elevation?

我的未来我决定 提交于 2019-12-21 05:05:58

问题


I have an installer I'd like to run from a script. The installer requests UAC elevation but it doesn't need elevation because I'm installing to a user directory. Is there some way to run the installer so that it doesn't request UAC elevation?

The script is written in Python so I can access the Windows API through ctypes.

Changing the installer is not an option.


回答1:


You have to set the enviromnet variable __compat_layer for your process to RunAsInvoker. Then you can run the executable without any UAC prompt.

You can use the Windows API function SetEnvironmentVariable for this purpose.



来源:https://stackoverflow.com/questions/7086978/can-i-stop-an-executable-from-requesting-uac-elevation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!