简体   繁体   English

以编程方式接受UAC提示

[英]Accept UAC Prompt Programmatically

I have a C# application that needs to run with administrative permissions. 我有一个C#应用程序,需要以管理权限运行。 In particular, it loads at Windows 7 start-up and executes a few scripts in the background. 特别是,它将在Windows 7启动时加载并在后台执行一些脚本。 This process is fully invisible to the user and is covered up with a background when executing. 用户完全看不见此过程,执行时会被背景遮盖。 The permissions implementation is via a manifest file. 权限实现是通过清单文件实现的。 Now, the problem is that I need to automate the step where UAC prompt comes up, and invisibly accept it. 现在,问题是我需要自动执行出现UAC提示的步骤,并以无形的方式接受它。

How would something like that be done in C#? 用C#怎么做?

I think what you have to do is impersonate a user with administrator privileges. 我认为您需要做的是用管理员权限模拟用户。

Try this: http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx 试试这个: http : //msdn.microsoft.com/en-us/library/chf6fbt4.aspx

I have had success with this method before, give it a shot! 我以前使用此方法已经成功,请尝试一下!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM