I have a project with different variants , which all install to the same location e.g. C:\ABC\
. Here the uninstallers are named unins000, unins001.. and so on. I have searched on net to changed the uninstaller names, and there is no inherent way to change the uninstaller name.
I have a workaround , by which I use the [Run]
section to rename unins000.exe
to the name of my choice. This works great on project folders when there will be only one uninstaller. However, in my case, the uninstaller name is not known to me.
Can someone suggest me a way to get the uninstaller name ? I will put the name accordingly in my code.
Please don't suggest me to look for timestamp. That will not be an acceptable solution.
Thanks in advance.
I added the code below I used to achieve I wanted. Basically, what I am doing now is I create a seperate folder for each variant, where I store the individual uninstaller ( as I was not able to get the uninstaller which I will need to rename ) .
The project structure is now
C:\ABC\Uninst\<Variant-1>\<variant1-uninstaller>
C:\ABC\Uninst\<Variant-2>\<variant2-uninstaller>
Add the [Run]
section , this will change the uninstaller name to whatever is required. Also, registry entry in HKLM will be modified so that shortcuts and Control panel can uninstall the programs without any issues.
`[Run]
;First rename the uninstaller files, then modify in registry
; /C : run CMD, execute command, then close the CMD.exe
Filename: {cmd}; Parameters: "/C ren ""{app}\Uninst\unins000.exe"" ""Uninstall_{#ApplicationName}.exe"""; Flags: RunHidden WaitUntilTerminated
Filename: {cmd}; Parameters: "/C ren ""{app}\Uninst\unins000.dat"" ""Uninstall_{#ApplicationName}.dat"""; Flags: RunHidden WaitUntilTerminated
; REG ADD [ROOT\]RegKey /v ValueName [/t DataType] [/S Separator] [/d Data] [/f]
; /F : Force overwrite
Filename: REG; Parameters: "ADD ""HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#AppNameInReg}_is1"" /V ""UninstallString"" /T ""REG_SZ"" /D ""\""{app}\Uninst\Uninstall_{#ApplicationName}.exe"""" /F"; StatusMsg: Flags: RunHidden WaitUntilTerminated
Filename: REG; Parameters: "ADD ""HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#AppNameInReg}_is1"" /V ""QuietUninstallString"" /T ""REG_SZ"" /D ""\""{app}\Uninst\Uninstall_{#ApplicationName}.exe /SILENT"""" /F"; Flags: RunHidden WaitUntilTerminated
Add the following line in [Setup]
section
UninstallFilesDir={app}\Uninst\
This will create unins000.exe
in Uninst
folder.
Please note that I have solved my issue. I posted my code for any one who want to do similiar things.