简体   繁体   English

NSIS安装程序后启动可执行文件

[英]Starting executable after NSIS installer

At the end of my installer, I want to start an .exe file and then end the installation. 在我的安装程序结束时,我想启动一个.exe文件,然后结束安装。 I have tried various ways to start this exe, shown below, but none of them are quite right. 我已经尝试了各种方法来启动这个exe,如下所示,但它们都没有完全正确。 The .exe file brings up a login screen and the user inputs username and password, and a main application starts. .exe文件显示登录屏幕,用户输入用户名和密码,并启动主应用程序。

When I double-click the .exe in the folder, it brings up the login prompt, I put in the credentials, and the application starts. 当我双击文件夹中的.exe时,它会显示登录提示,我输入凭据,然后应用程序启动。 The following methods were tried in the installer to replicate this process: 在安装程序中尝试了以下方法来复制此过程:

ExecDos async ExecDos异步

ExecDos::exec /NOUNLOAD /ASYNC '$Path${APP_FILE_NAME}'
Sleep 30000

ExecShell ExecShell

ExecShell "" '"$Path${APP_FILE_NAME}"'

ExecDos ExecDos

ExecDos::exec '$Path${APP_FILE_NAME}'

nsExec nsExec

nsExec::exec '$Path${APP_FILE_NAME}'

Ideally, I would like to get the asynchronous call working so it would kick off the login screen and then end of the installer. 理想情况下,我想让异步调用工作,这样它就会启动登录屏幕然后结束安装程序。

All of the above methods present the login screen as expected, but after logging into the application, the main application just sits on a blank gray screen...something I do not see if I simply double click the .exe in the $Path folder and log in normally. 所有上述方法都按预期显示登录屏幕,但登录到应用程序后,主应用程序只是位于一个空白的灰色屏幕上......如果我只是双击$ Path文件夹中的.exe,我就看不到了并正常登录。

Is there something wrong with making these calls to start the .exe? 这些调用启动.exe是否有问题?

The problem is probably with your application and not NSIS... 问题可能出在你的应用上,而不是NSIS ......

If the application depends on the "correct" working directory you need to use SetOutPath first: 如果应用程序依赖于“正确”的工作目录,则需要首先使用SetOutPath:

SetOutPath $INSTDIR
ExecShell "" '"$INSTDIR\myapp.exe"'

Executing the main application at the end of the installer is problematic since it can end up running the app as the wrong user (UAC on, logged in as non-admin and elevating with a admin user (Assuming you did not set RequestExecutionLevel or used RequestExecutionLevel admin )) 在安装程序结束时执行主应用程序是有问题的,因为它可能最终以错误的用户身份运行应用程序(UAC打开,以非管理员身份登录并使用管理员用户提升(假设您未设置RequestExecutionLevel或使用RequestExecutionLevel admin ))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM