如何让 NSIS 安装并执行临时目录中的文件?
我正在使用以下 NSIS 脚本:
Name "My app wrapper"
Outfile "MyAppSetup.exe"
InstallDir $TEMP\MyApp\Install
Function .onInit
SetSilent silent
FunctionEnd
Section ""
SetOutPath $TEMP\MyApp\Install
File installer.msi
File setup.exe
Exec setup.exe
SectionEnd
目的是安装程序将这两个文件 installer.msi 和 setup.exe (这是安装先决条件然后调用 installer.msi 的引导程序)打包到 MyApp Setup.exe 中文件。运行 MyAppSetup.exe 时,它应该将 installer.msi 和 setup.exe 提取到 $Temp\MyApp\Install 目录,并且应该从该目录运行 setup.exe。
但是,当我从桌面运行 MyAppSetup 时,它会执行在桌面上找到的 setup.exe 文件,而且我什至在 C:\Temp 中看不到 MyApp\Install 目录。
我需要做什么才能让这个脚本将文件安装到正确的位置并执行正确的文件?
I'm using the following NSIS script:
Name "My app wrapper"
Outfile "MyAppSetup.exe"
InstallDir $TEMP\MyApp\Install
Function .onInit
SetSilent silent
FunctionEnd
Section ""
SetOutPath $TEMP\MyApp\Install
File installer.msi
File setup.exe
Exec setup.exe
SectionEnd
The intention is that the installer will wrap up those two files, installer.msi and setup.exe (which is a bootstrapper to install prereqs and then call installer.msi) into the MyApp Setup.exe file. When MyAppSetup.exe is run, it should extract installer.msi and setup.exe to the $Temp\MyApp\Install directory, and it should run setup.exe from that directory.
However, when I run MyAppSetup from the desktop, it executes a setup.exe file that it finds on the desktop, and I don't even see a MyApp\Install directory in C:\Temp.
What do I need to do to get this script to install the files to the right location and to execute the right file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道它是否能解决您的问题,但我会写:
您确定 $TEMP 指向 C:/Temp 吗?你检查了吗?
I don't know if it would solve your problem but I would write :
Are you sure that $TEMP is pointing to C:/Temp? Did you check it?
这是另一种方法
This is another way to do it