Search code examples
nsis

Execute files which are generated while runtime


Still in progress with NSIS Setup.

The thing is now I´m executing NSIS executables during my "main" setup. Those other setups, which I´m executing, generate uninstaller for themselve. When I´m performing the uninstaller in the main setup I would like to call those generated uninstaller files.

I´m doing the execution with nsExec::ExecToLog but if a executable is not from the decompressed from the .exe you won´t be able to execute it. Am I right? Is there any solution to solve this problem?

I´m very grateful for every answer!


Solution

  • You can use nsExec::ExecToLog with whatever you like.

    It could be extracted:

    SetOutPath $INSTDIR
    File foo.exe
    nsExec::ExecToLog $INSTDIR\foo.exe
    

    It could be a path already known:

    nsExec::ExecToLog $WINDIR\bar.exe
    

    It could be calculated:

    ReadINIStr $0 $INSTDIR\uninstaller-paths.ini UninstallerPaths baz
    nsExec::ExecToLog $0
    

    It really doesn't matter. As far as the script is concerned, it's purely a command string to execute.