PDA

View Full Version : Run a batch file during uninstall



vladdid
08-18-2003, 12:53 PM
Colleagues,

I did create a package using the wizard and added a line there to run a batch script before the end of the install.

Installation works fine, however uninstallation is not clean, since I did not put a matching batch to run before actual uninstall starts. I do not see a place in the InstallShield script, where to put it. Any suggestions?

Sincerely,
Vlad.

niranbhimaiah
08-18-2003, 11:15 PM
You can put your code line "onmaintUIBefore" event. Before running you code for uninstallation, please check whether the user has opted for unistallation since the onmaintUIBefore event will be applicable for overwrite/repair and Add/Remove components as well.

Regards
Niran Bhimaiah

vladdid
08-19-2003, 08:39 AM
Thank you, I will try it now. But how do I check if it is an uninstall or maintenance? Or, may I just disable the modify/repair mode altogether ( it is not needed here )?

Thanks again for the reply!

niranbhimaiah
08-19-2003, 11:23 PM
If you do not require Add/Modify. do the following:

Put this code in the event OnfirstUiBefore:
UNINSTALL_STRING = UNINSTALL_STRING + "REMOVE";

Comment the code in OnMaintenanceUIBefore and put the following code:
if (CMDLINE % "REMOVE" )then
//Setup being run from windows add/remove program
//put your unistall codes
ComponentRemoveAll();

else
//Setup is run from source/CD. You can prompt for overwrite
//Overwrite code
ComponentReinstall()

endif;

Hope this helps

Regards
Niran Bhimaiah