0

我面临一个很难解决的问题,我已经阅读了很多关于管理员权限 .NET 应用程序的问题,但几乎都是关于以管理员身份登录的 UAC 弹出消息。我想要的是:当我启动我的应用程序时,在运行所有代码之前要做的第一件事是以管理员身份登录以授予应用程序管理员权限而不向用户询问任何内容。

有任何想法吗?

4

1 回答 1

0

The real question is why does your app need to run with elevated privileges? If you need that, you can use an application manifest to request elevation and then educate your users that they must confirm elevation. But you cannot bypass the UAC prompt, and this is by design.

FAQ: Why can't I bypass the UAC prompt?

Excerpt:

If it were possible to mark an application to run with silently-elevated privileges, what would become of all those apps out there with LUA bugs? Answer: they'd all be marked to silently elevate. How would future software for Windows be written? Answer: To silently elevate. Nobody would actually fix their apps, and end-user applications will continue to require and run with full administrative permissions unnecessarily.

Bill

于 2013-04-01T14:38:31.197 回答