Remove all data after cancellation of installation - Advanced Installer Community
Marcus
Posts: 3
Joined: Thu Jun 13, 2019 1:21 pm

Remove all data after cancellation of installation

Hallo forum,

I am currently having issues when cancelling a installation. When a user installs our software and cancels the installation while files and folders are copied, there are some leftover folders after the installation rollback. I used the uninstall cleanup wizard to make some settings on the folders that are left after cancelling the installation, but it did not help.

Is there any way to make sure that if a user cancels the installation process, that everything in the APPDIR is deleted? Did anyone else run into this kind of behavior?

One workaround I thought about was using a .bat script that deletes the whole APPDIR folder when the user presses the "Finish" button on the last dialog after cancelling the installation. But I actually could not get a custom action that does this to work, calling the script always resulted in an error. Maybe I am confusing the different stages of the installer.

I added my .bat file as a temporary ressource:

Image

I created a custom action to execute the file and pass the APPDIR:

Image

I wanted to call the custom action when pressing the "Finish" button on the user exit dialog:

Image

The content of my script:

Code: Select all

del /s /f /q %1
for /f %%f in ('dir /ad /b %1') do rd /s /q %1\%%f

Thank you for any help or suggestions! :-)
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Remove all data after cancellation of installation

Hello Marcus,

You are right. The custom changes that are made by your setup will not be undone by the rollback script.

The correct approach in this case is, indeed, to create your own custom action that will do the cleanup as you have already did.

From what I can see, you have added your .BAT file as a temporary file and then you try to launch it through our "LaunchFile" custom action, triggered by the "Finish" button.

The error you are encountering here may be due to the fact that your temporary file is already gone when the custom action executes. Please keep in mind that Temporary Files are copied during the CostFinalize standard action, at the beginning of the setup and removed during the InstallFinalize standard action. This means that when you are trying to launch the .BAT file, it has already been removed.

To avoid such a behavior, you could simply go to "Files and Folders" page --> double click on your .bat file --> check the "Do not remove the file when setup ends" option.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”