如何使用提升的权限运行自定义可执行文件? [英] How to run custom executable with elevated privileges?

查看:20
本文介绍了如何使用提升的权限运行自定义可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在安装后和卸载前为自定义设置/拆卸运行可执行文件.它需要以提升的权限运行.如何正确执行此操作?

I need to run executable for custom setup/tear down, after install and before uninstall. It needs to run with elevated privileges. How to do this correctly?

推荐答案

所以,最终的解决方案是这样的:

So, the final solution was like this:

<CustomAction Id="Install" Directory="APPLICATIONROOTDIRECTORY"
              Execute="deferred" Impersonate="no" Return="ignore"
              ExeCommand="[APPLICATIONROOTDIRECTORY]MyExeName.exe -install" />

<CustomAction Id="Uninstall" Directory="APPLICATIONROOTDIRECTORY"
              Execute="deferred" Impersonate="no" Return="ignore"
              ExeCommand="[APPLICATIONROOTDIRECTORY]MyExeName.exe -uninstall" />

<InstallExecuteSequence>

  <Custom Action='Install' After='InstallFiles' >
    $ProductComponent = 3
  </Custom>

  <Custom Action='Uninstall' After='InstallInitialize' >
    ?ProductComponent = 3
  </Custom>

</InstallExecuteSequence>

有什么改进的建议吗?

这篇关于如何使用提升的权限运行自定义可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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