如何让NSIS从临时目录安装和执行文件?

Mik*_*ras 9 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
Run Code Online (Sandbox Code Playgroud)

目的是安装程序将这两个文件:installer.msi和setup.exe(它是一个安装prereq的引导程序然后调用installer.msi)包装到MyApp Setup.exe文件中.运行MyAppSetup.exe时,它应将installer.msi和setup.exe解压缩到$ Temp\MyApp\Install目录,并且应该从该目录运行setup.exe.

但是,当我从桌面运行MyAppSetup时,它会执行它在桌面上找到的setup.exe文件,我甚至都看不到C:\ Temp中的MyApp\Install目录.

要使此脚本将文件安装到正确的位置并执行正确的文件,我需要做什么?

And*_*ers 12

Section
InitPluginsDir
SetOutPath "$pluginsdir\MyApp\Install" ;It is better to put stuff in $pluginsdir, $temp is shared

File installer.msi
File setup.exe

ExecWait '"$pluginsdir\MyApp\Install\setup.exe"' ;You should always use full paths and proper quotes

SetOutPath $exedir ;Change current dir so $temp and $pluginsdir is not locked by our open handle
SectionEnd
Run Code Online (Sandbox Code Playgroud)


F-A*_*F-A 5

我不知道它是否能解决你的问题,但我会写:

Exec $TEMP\MyApp\Instal\setup.exe
Run Code Online (Sandbox Code Playgroud)

您确定 $TEMP 指向 C:/Temp 吗?你检查了吗?