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

发布于 2024-12-15 14:35:24 字数 712 浏览 1 评论 0原文

在安装程序结束时,我想启动 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安静被遗忘 2024-12-22 14:35:24

问题可能出在您的应用程序而不是 NSIS...

如果应用程序依赖于“正确”的工作目录,您需要首先使用 SetOutPath:

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

在安装程序末尾执行主应用程序是有问题的,因为它最终可能会运行应用程序作为错误的用户(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:

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))

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文