I am using InstallShield 2015 and project type is basic MSI. I need to run a few different batch files during the install process as well as the uninstall process. For the install process I created a custom action to run an EXE (or batch file in my case). The working folder is the SystemFolder and the command line is the following:
"[SystemFolder]cmd.exe" /c "[INSTALLDIR]PrinterInstaller\installPrinterDriver.cmd" [INSTALLDIR]PrinterInstaller\
This works perfect during the install process. A problem occurs during the uninstall. I have another custom action for the uninstall:
"[SystemFolder]cmd.exe" /c "[INSTALLDIR]PrinterInstaller\removePrinterDriver.cmd"
This above does not work. I reviewed the log and [installdir] is returning the default path instead of the path the user chooses during the install process. So if the user accepts the default install path during installation, everthing works great. If they choose a different path, the uninstall process fails. I researched this and my mistake is that I can't use the INSTALLDIR property during uninstall as it will return the default. I've read several posts on this subject and I understand the problem. I am facing the same issue with some custom installscript that runs during the uninstall process. I solved this by using the registry to store the "user" selected install folder during install then retrieving it during the uninstall. This works. Is there a way to apply a similar technique to custom actions that run batch files? I mean, can I lookup from the registry somehow and get rid of the [INSTALLDIR] syntax in my command line.
Here is a similar post, but was not a solution for me:
Install file create by InstallShield 2012 sometimes did not get the proper INSTALLDIR when uninstall