英文:
How to Programmatically select the Run this program as an Administrator Checkbox option for C# Application exe in Windows 10?
问题
我想要默认启用“以管理员身份运行此程序”复选框选项,以便不需要用户每次右键单击exe并选择“以管理员身份运行”。1)在构建.NET应用程序时,是否有办法以编程方式启用此选项?2)在创建MSI安装程序时,是否可能设置此复选框启用?
手动启用选项的步骤
- 右键单击C# EXE
- 选择属性
- 转到兼容性选项卡
- 选择“以管理员身份运行此程序”复选框
请参考附图:
英文:
I would like to set the "Run this program as an Administrator" Checkbox option enabled by default. So that it does not require user to Right click on exe and select Run As administrator every time.
- While building the exe in .Net Application, is there any way to enable this option programmatically?
- While Creating MSI installer, is it possible to set this checkbox enable?
Steps to Manually Enable Option
- Right click on C# EXE
- Select Properties
- Go to compatibility tab
- Choose Run this program as an Administrator Checkbox
Refer the attached Image
答案1
得分: 2
你可以使用选项"requestedExecutionLevel"和值"requireAdministrator"来编写或生成应用程序清单文件。
更多详情请参考:https://learn.microsoft.com/en-us/previous-versions/bb756929(v=msdn.10)?redirectedfrom=MSDN。
英文:
I suppose you can write or generate Application Manifest file with option "requestedExecutionLevel" and value "requireAdministrator".
See https://learn.microsoft.com/en-us/previous-versions/bb756929(v=msdn.10)?redirectedfrom=MSDN for more details.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论