NSIS 安装程序后启动可执行文件
在安装程序结束时,我想启动 .exe 文件,然后结束安装。我尝试了各种方法来启动这个exe,如下所示,但没有一个是完全正确的。 .exe 文件会显示登录屏幕,用户输入用户名和密码,然后主应用程序启动。
当我双击文件夹中的 .exe 时,它会弹出登录提示,我输入凭据,应用程序就会启动。在安装程序中尝试了以下方法来复制此过程:
ExecDos async
ExecDos::exec /NOUNLOAD /ASYNC '$Path${APP_FILE_NAME}'
Sleep 30000
ExecShell
ExecShell "" '"$Path${APP_FILE_NAME}"'
ExecDos
ExecDos::exec '$Path${APP_FILE_NAME}'
nsExec
nsExec::exec '$Path${APP_FILE_NAME}'
理想情况下,我希望异步调用正常工作,以便它将启动登录屏幕,然后结束安装程序。
上述所有方法都按预期显示登录屏幕,但登录到应用程序后,主应用程序只是位于空白的灰色屏幕上...如果我只是双击 $Path 文件夹中的 .exe,我就看不到这种情况并正常登录。
进行这些调用来启动 .exe 是否有问题?
At the end of my installer, I want to start an .exe file and then end the installation. I have tried various ways to start this exe, shown below, but none of them are quite right. The .exe file brings up a login screen and the user inputs username and password, and a main application starts.
When I double-click the .exe in the folder, it brings up the login prompt, I put in the credentials, and the application starts. The following methods were tried in the installer to replicate this process:
ExecDos async
ExecDos::exec /NOUNLOAD /ASYNC '$Path${APP_FILE_NAME}'
Sleep 30000
ExecShell
ExecShell "" '"$Path${APP_FILE_NAME}"'
ExecDos
ExecDos::exec '$Path${APP_FILE_NAME}'
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.
Is there something wrong with making these calls to start the .exe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题可能出在您的应用程序而不是 NSIS...
如果应用程序依赖于“正确”的工作目录,您需要首先使用 SetOutPath:
在安装程序末尾执行主应用程序是有问题的,因为它最终可能会运行应用程序作为错误的用户(UAC 打开,以非管理员身份登录并使用管理员用户进行提升(假设您没有设置
RequestExecutionLevel
或使用RequestExecutionLevel admin
))The problem is probably with your application and not NSIS...
If the application depends on the "correct" working directory you need to use SetOutPath first:
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 usedRequestExecutionLevel admin
))