installationinno-setupuninstallation

Change the default name of an Inno Setup uninstaller to avoid naming conflicts


I need to install a couple of installers in the same directory so it conflicts with the Inno Setup uninstaller name unins000.exe and unins000.dat

Is there a way to change the default name of an Inno Setup uninstaller?


Solution

  • This is similar to Elektrostudios' answer, and is what worked for me:

        Filename: {cmd}; Parameters: "/C Mkdir ""{app}\Uninstallers\{#MyAppName}"""; Flags: RunHidden WaitUntilTerminated
        Filename: {cmd}; Parameters: "/C Move ""{app}\unins000.exe"" ""{app}\Uninstallers\{#MyAppName} - uninstall.exe"""; StatusMsg: Installing {#MyAppName}...; Flags: RunHidden WaitUntilTerminated
        Filename: {cmd}; Parameters: "/C Move ""{app}\unins000.dat"" ""{app}\Uninstallers\{#MyAppName} - uninstall.dat"""; StatusMsg: Installing {#MyAppName}...; Flags: RunHidden WaitUntilTerminated
        Filename: {cmd}; Parameters: "/C Move ""{app}\unins000.msg"" ""{app}\Uninstallers\{#MyAppName} - uninstall.msg"""; StatusMsg: Installing {#MyAppName}...; Flags: RunHidden WaitUntilTerminated
        Filename: REG.exe; Parameters: "ADD ""HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Windows 8 ContextMenu - {#MyAppName}_is1"" /V ""UninstallString"" /T ""REG_SZ"" /D ""\""{app}\Uninstallers\{#MyAppName} - uninstall.exe\"""" /F"; StatusMsg: Installing {#MyAppName}...; Flags: RunHidden WaitUntilTerminated
        Filename: REG.exe; Parameters: "ADD ""HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Windows 8 ContextMenu - {#MyAppName}_is1"" /V ""QuietUninstallString"" /T ""REG_SZ"" /D ""\""{app}\Uninstallers\{#MyAppName} - uninstall.exe\"" /SILENT"" /F"; StatusMsg: Installing {#MyAppName}...; Flags: RunHidden WaitUntilTerminated
    

    Using Windows 7, I discovered that the "Move" command wouldn't work unless I had somewhere to move the files to first, meaning that I had to add the mkdir line at the top. Also, the uninstaller wouldn't work without the .msg file moved as well, so I followed the pattern and added that line too.

    I didn't bother to change "Windows 8" to "Windows 7" but it didn't make any difference, so I'm leaving it alone. If there's a problem with that I'm unaware of, I'm sure someone will indicate such in a comment.

    {#MyAppName} is, of course, the constant defined at the top of the ISS file declaring the name of the application. Your constant may be defined differently, so you'll need to change it to match where necessary.