[UninstallDelete] section

Inno Setup

[UninstallDelete] section

This optional section defines any additional files or directories you want the uninstaller to delete, besides those that were installed/created using [Files] or [Dirs] section entries. Deleting .INI files created by your application is one common use for this section. The uninstaller processes these entries as the last step of uninstallation.

Here is a example of a [UninstallDelete] section:

[UninstallDelete]
Type: files; Name: "{win}\MYPROG.INI"

The following is a list of the supported parameters:

Type  (Required)

Specifies what is to be deleted by the uninstaller. This must be one of the following:

files

The Name parameter specifies a name of a particular file, or a filename with wildcards.

filesandordirs

Functions the same as files except it matches directory names also, and any directories matching the name are deleted including all files and subdirectories in them.

dirifempty

When this is used, the Name parameter must be the name of a directory, but it cannot include wildcards. The directory will only be deleted if it contains no files or subdirectories.

Example:
Type: files
Name  (Required)

Name of the file or directory to delete.

NOTE: Don't be tempted to use a wildcard here to delete all files in the {app} directory. Doing this is strongly recommend against for two reasons. First, users usually don't appreciate having their data files they put in the application directory deleted without warning (they might only be uninstalling it because they want to move it to a different drive, for example). It's better to leave it up to the end users to manually remove them if they want. Also, if the user happened to install the program in the wrong directory by mistake (for example, C:\WINDOWS) and then went to uninstall it there could be disastrous consequences. So again, DON'T DO THIS!

Example:
Name: "{win}\MYPROG.INI"

Components and Tasks Parameters

Common Parameters