Search code examples
batch-filecmdwixiexpress

Wix bundle runs a compiled BAT file at the end, that force shutdown


this is a simplistic example of my problem:

I have this simple bundle

<Chain>
  <ExePackage SourceFile="C:\Users\this\Desktop\AAA\eee.exe"></ExePackage>
</Chain>

the eee.exe is the result of IEXPRESS of two files

  • eee.bat
  • eee.txt

IEXPRESS runs cmd /c eee.bat

eee.bat do some stuff then finishes with this line

shutdown -r -f -t 0

once the result of the Wix, the installer, is run it forces the reboot then rerun the instller

how can we change the behaviour of this so it will not rerun the installer after the reboot


Solution

  • Forcing a restart in the middle of your installation is not good practice. As comments to your post pointed out, you are interrupting your own installer. Instead, you can use a successful exit code (0) to tell your installer to reboot.

    <Chain>
       <ExePackage SourceFile="C:\Users\this\Desktop\AAA\eee.exe">
          <ExitCode Value="0" Behavior="forceReboot"/>
      </ExePackage>
    </Chain>
    

    Don't forget to take the shutdown line out of the BAT file.