Search code examples
nsis

How can I get NSIS to install and execute files from a temp directory?


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?


Solution

  • I don't know if it would solve your problem but I would write :

    Exec $TEMP\MyApp\Instal\setup.exe
    

    Are you sure that $TEMP is pointing to C:/Temp? Did you check it?