如何以提升的权限运行自定义可执行文件? [英] How to run custom executable with elevated privileges?
本文介绍了如何以提升的权限运行自定义可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在安装之后和卸载之前运行可执行文件以进行自定义设置/拆卸.它需要以提升的权限运行.如何正确地做到这一点?
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屋!
查看全文