Search code examples
nsis

Is it possible to package an exe into an NSIS generated installer which runs first?


Is it possible to generate an NSIS installer (using a .nsi) which packages an exe (let's say foobar.exe) which is then run before the installer actually installs the program as normal? I assume it'd have to extract the exe to a temp dir before running it, which is fine. It must be run before the main install however.


Solution

  • Initpluginsdir
    File "/oname=$pluginsdir\myapp.exe" "c:\build\myapp.exe"
    ExecWait '"$pluginsdir\myapp.exe"'
    Delete "$pluginsdir\myapp.exe" ;delete is optional, $pluginsdir is auto-deleted when installer quits
    

    Put before other code in your first section or in .onInit (Depending on what myapp.exe does etc)