Uninstall former version

  • Print

If you wish to uninstall the existing version of your product automatically when your customer runs the installer made with Setup Factory of a newer (or the same) version, you can use this screen and script:

How to use

  • Download the installer below and select the desired package for installation. The files will be deployed in:

    For Windows XP:
    C:\Documents and Settings\All Users\Application Data\IndigoRose\Setup Factory\9.0\Screens\

    For Windows Vista or Windows 7:
    C:\ProgramData\IndigoRose\Setup Factory\9.0\Screens\

  • Include the custom screen in your installer, offering the option to uninstall the former version of your product before deploying the new files. The screen is named "Former install found":
  • Finally, you should then include the following code in the On Pre Install script:
-- check if uninstall was requested
if (bRequestedUninstall) then
    if (File.DoesExist(sMyUninstallInfo[1])) then
        -- perform a silent uninstall of the application
        -- add quotes to configuration file argument (it may contain spaces)
        -- and add /S at the end
        res = File.Run(sMyUninstallInfo[1], '"'..sMyUninstallInfo[2]..'" /S', "", 
            SW_SHOWNORMAL, true);
        error = Application.GetLastError();
        if (error ~= 0) then
            Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
            SetupData.WriteToLogFile("Info\tUninstallation performed successfully\r\n", true);
            -- wait for the uninstaller to be deleted in the background
            -- before deploying the new files (it can take a second or two)
            StatusDlg.SetTitle("Deleting old version");
            StatusDlg.SetMessage("Please wait...");
            while File.DoesExist(sMyUninstallInfo[1]) do
                SetupData.WriteToLogFile("Waiting one second...\r\n", true);
        SetupData.WriteToLogFile("Error\tUninstaller could not be found!\r\n", true);


Custom Screens for Setup Factory 9

Click to downloadFile size: 1.92 MB
Current version:
Updated: February 2013

Example project

Click to downloadFile size: 18 KB
Updated: October 2010

Make sure that you enabled the silent uninstall in your project (see Uninstall > Settings > Options > Allow silent uninstall), or your customer will see the uninstallation wizard.

Don't have Setup Factory?

If you want to purchase a license for Setup Factory 9, now is a good time! You can get 10% off the list price simply by clicking the banner below:


Our Plugins & Examples Feed

  • Microsoft .NET Framework 4.6.1 Dependency
    A new dependency installer was added to the site. Users of MSI Factory can now...
  • Microsoft Access Runtime 2016

    The new dependency checks for:

    • Microsoft Office Access Runtime 2007
    • Microsoft Office Access Runtime 2010 (x86)
    • Microsoft Office...
Subscribe now!