如何在安装结束时以适当的权限启动可执行文件? [英] How to launch an executable on the end of installation with proper rights?
问题描述
我在安装完成后以这种方式启动我的 Windows 应用程序:
I'm launching my Windows application this way after the installation completes:
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchApplication"
...
Function LaunchApplication
ExecShell "" "$INSTDIR\Application.exe"
FunctionEnd
但这有一个奇怪且不受欢迎的副作用.显然是我的应用程序以管理员权限启动.
But this has a strange and undesired side-effect. Apparently is my application launched with admin rights.
我不能拖动 &在网络浏览器(使用 Firefox 和 IE 测试)和我的应用程序之间删除任何数据.
I cannot drag & drop any data between a web browser (tested with Firefox and IE) and my application.
如果我退出我的应用程序(会话从 NSIS 开始),然后从开始菜单图标重新启动它,一切正常!- 我可以拖动 &毫无问题地放到浏览器中.
If I quit my application (the session started from NSIS), and restart it from the start menu icon everything works! - I can drag & drop to the browsers without problems.
所以我怀疑因为在安装开始时有一个 UAC 请求,不知何故 UAC 权限会转移到我在安装后启动的进程中.由于浏览器在低安全性进程中运行,Windows 拒绝与它们交换任何数据(在使用 NSIS 启动的进程实例中).
So I suspect since in the beginning of installation there is a UAC request, somehow UAC rights are transferred to the process I'm launching after installation. Since the browsers run in a low security process Windows refuses to exhange any data with them (in the process instance that is launched with NSIS).
如何从 NSIS 启动一个 exe,从而不发生这种 UAC/安全问题?
How to launch an exe from NSIS, so that this UAC/security problem does not happen?
推荐答案
Use Exec '"$WINDIR\explorer.exe" "$TEMP\MyUnElevatedProcess.exe"'
取自 http://mdb-blog.blogspot.com/2013/01/nsis-lunch-program-as-user-from-uac.html
这篇关于如何在安装结束时以适当的权限启动可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!