cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Pankaj_Kahal
Level 3

How to run a .bat file when Uninstalling

I somehow am able to run an install.bat file during installation.

But cant figure out how to run a UnInstall.bat when uninstall/Remove is done.

Kindly suggest.
Labels (1)
0 Kudos
(6) Replies
charlieantao
Level 6

Can you provide a little background on your requirement?
What type of IS project is it? Basic MSI? Installscript?
What's the reason you want to run the uninstall.bat? Doesn't the installer take care of uninstallation?
Where is the uninstall.bat located? INSTALLDIR?
0 Kudos
m_rudolph
Level 6

If it's InstallScript; perhaps try in the OnEnd() section:

if (REMOVEALLMODE) then
LaunchAppAndWait (szBatchFile, szParam, LAAW_OPTION_HIDDEN);
endif;
0 Kudos
Pankaj_Kahal
Level 3

I am using Basic MSI Project. Have to do some tasks like registering dlls, installing and starting .NET services when i install. And need to do the reverse when I do the uninstall.

I have an Install.bat which first gets copied on the target machine when installation takes place. Its is then run/executed. (have this .bat called under "Custom Actions and Sequences"->"Custom Actions")

But dunno what to do to call the UnInstall.bat during UnInstallation. (I am a C++?C# programmer. Never done InstallShield stuff before!) Whatever I have done so far is just based on general browsing of the InstallShield.

Regards
0 Kudos
Pankaj_Kahal
Level 3

Is there any specific Property/Custon Action that I need to specify like "Execution Scheduling" for the UnInstall.bat Custom Action before the file is removed from the target machine?
0 Kudos
charlieantao
Level 6

If your problem is that the uninstall.bat file is getting removed from the system before the script is run, try adding the custom action that calls it before the RemoveFiles action.

A workaround could be to add it to support files and call it from SUPPORTDIR using LaunchAppAndWait
0 Kudos
RobertDickau
Flexera Alumni

Please see this newsletter tip for information about the condition you'd use on your action (PDF warning): http://www.macrovision.com/webdocuments/PDF/msiconditions.pdf.

To occur before files are removed, you'd probably want to schedule your action before the RemoveFiles action.
0 Kudos