Search code examples
inno-setupinstallshield

Inno Setup Exec doesn't wait for InstallShield uninstallation to complete


Trying to uninstall a software using the uninstall string (and running that with Exec in InitializeSetup) before installation, it doesn't wait for the un-installation to complete but proceeds to the next step of installation in Inno Setup.

I am using the following code and the software I am trying to un-install in an Installshield product:

Exec(
  ExpandConstant('{pf}\InstallShield Installation Information\{{XXX8X88X-XX8X-88X8-X8XX-88X888X88888}\setup.exe'),
  '-s -runfromtemp -l0x0004 -removeonly -remove', '',
  SW_SHOW, ewWaitUntilTerminated, ReturnCode)

Solution

  • The setup.exe most probably executes a subprocess for an actual uninstallation and exits itself. So Inno Setup seemingly does not wait for the process to finish. This is a common behavior, as the uninstaller needs to delete itself, what it cannot do, if it still running. So it creates a copy of itself (or another executable) in a temporary folder and (re)executes from there.

    As per InstallShield documentation, you can try adding /w or /Clone_wait switches to the command-line:

    /w ... For a Basic MSI project, the /w option forces Setup.exe to wait until the installation is complete before exiting.

    /Clone_wait ... This parameter indicates that the original setup should wait for the cloned setup process to complete before exiting.