在Win 7启动期间启动提升的程序 [英] Launch elevated program during startup in win 7

查看:98
本文介绍了在Win 7启动期间启动提升的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

如何在启动时启动需要提升的应用程序.目前,我通过使用注册表来使用标准方法.但是它以某种方式不起作用,似乎被忽略,没有应用程序启动.任何人都有一个想法>

Hello,

How do I launch my application at startup which required elevation. Currently I use standard method by using registry. But somehow it doesn''t work, it seems ignore, no application started. Anyone have an idea>

推荐答案

您需要为您的应用程序创建一个清单文件.

将清单文件放置在您的应用程序中,该文件可能包含:

You need to create a manifest file for your application.

place the manifest file within your application that may contain :

<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the
            requestedExecutionLevel node with one of the following.
        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />
            If you want to utilize File and Registry Virtualization for backward
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel level="requireAdministrator" uiAccess="true" />
      </requestedPrivileges>
      <applicationRequestMinimum>
        <defaultAssemblyRequest permissionSetReference="Custom" />
        <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
      </applicationRequestMinimum>
    </security>
  </trustInfo>
</asmv1:assembly>



当您调用该应用程序时,它将以管理员身份运行.



When you invoke the application it will run as administrator.


使用Windows 7,您的主要障碍是Windows 7自动阻止启动程序所需的时间超过启动时间.因此,您经常会看到一个气泡,上面写着"Windows阻止了一些启动程序"

您将必须找到某种通过预定义的登录凭据和UAC API表示同意的方法
With Windows 7, your main hurdle will be the fact that Windows 7 automatically blocks startup programs that take longer than they should to startup. Hence the bubble you will often see that says "Windows has blocked some startup programs"

You would have to find some way of giving consent via pre-defined login credentials and UAC API


这篇关于在Win 7启动期间启动提升的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆