top of page
Search
numchireca1971

Delete file after install inno setup tutorial: Tips and tricks for a clean uninstall



I was using the [Run] section to call cmd to delete the files but I wanted to improve the deletions by using Inno Setup code and not batch then I've seen the [InstallDelete] section but this delete the files BEFORE the [Run] section so... there is something I can do to delete the files after [Run] section?




Delete file after install inno setup tutorial



If you're trying to delete files created by that subinstall, then you should contact the vendors or check their documentation and see if there's a command line parameter you can pass to suppress installation of that item in the first place. There usually should be for optional things like desktop icons.


Firts I try to delete the original MSI package files if them exists in the [InstallDelete] section but that doesnt's delete the folder at all so then after that I extract a dummy file and folder in the same locations with the "deleteafterinstall" flag to delete them.


Instructs Setup to install the file as usual, but then delete it once the installation is completed (or aborted). This can be useful for extracting temporary data needed by a program executed in the script's [Run] section.


File is the "README" file. Only one file in an installation can have this flag. When a file has this flag, the user will asked if they would like to view the README file after the installation has completed. If Yes is chosen, Setup will open the file, using the default program for the file type. For this reason, the README file should always end with an extension like .txt, .wri, or .doc.


Windows' standard shared file reference-counting mechanism (located in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs) is used to keep track of how many applications depend on the file. Each time the file is installed, the reference count for the file is incremented. (This happens regardless of whether the installer actually replaces the file on disk.) When an application using the file is uninstalled, the reference count is decremented. If the count reaches zero, the file is deleted (with the user's confirmation, unless the uninsnosharedfileprompt flag is also specified).


When this flag is used and the file is in use at uninstall time, the uninstaller will queue the file to be deleted when the system is restarted, and at the end of the uninstallation process ask the user if they wants to restart. This flag can be useful when uninstalling things like shell extensions which cannot be programmatically stopped. Note that administrative privileges are required for this flag to have an effect.


When files with a .HLP extension (Windows help files) are uninstalled, the corresponding .GID and .FTS files are automatically deleted as well. Similarly, when a .CHM (HTML Help) file is deleted, any .CHW (generated index) file is automatically deleted.


The -c option is a little more tricky to explain. Suppose you opened an installationin a file manager and browsed to app\subdir\program.exe. Now if you copiedprogram.exe to another location, the entire directory tree (app\subdir\)would be created and program.exe would be extracted there. -c notifies innounpthat you are only interested in paths from the current directory and below, so that yourfile, program.exe, is extracted right where you intended to copy it, not severaldirectory levels deeper. Note that in order to avoid confusion, files must still bespecified by their full path names inside the installation.


Note that an installation can contain several identical files (possibly under different names). Inno Setupstores only one copy of such files, and by default innounp will also unpack one file. If you want to haveall files that could ever be installed anywhere, regardless of how many identical files this may get you,-a option will do it.


Describe the exact steps necessary to reproduce the bug. Say what are thepreconditions. Is the bug specific to some system settings? To a setup file youhave? (include the problem part of the installation script or a link to the compiledsetup, if it is small enough) To an IS version? To something else? Or does thebug occur regardless of these things?


Unless you are a die-hard fan of command line, you may like the idea of workingwith IS installations like with conventional archives in a file manager. Right nowtwo programs support this: FAR and Total Commander. Below are the instructionshow to integrate innounp into each.


If you have InstallExplorer installed (or another plug-in that handles IS,but you will need to adjust the settings accordingly), you might want to let itprocess all the other types of installations but keep IS installations for innounp.FAR does not provide a means of customizing the plug-in call order; however, anempirical study has shown that it loads plug-ins and applies them to files inlexical order. So the solution is to rename InstallExplorer's dll file from 6InstExpl.dllto e.g. zInstExpl.dll (and restart FAR).


Configuration made up by Gnozal and Maxwish and posted onTC forum. Change the path belowto where you have innounp installed and add this to your MultiArc.ini. Note thatMultiArc is not included in the default TC installation, instead it is available as aseparate download from Siarzhuk Zharski's web site.Refer to the help file for information on any additional configuration necessary.


If the file to be installed is a ReadMe file, the installer may prompt you to read this file after successful installation of the application. The isreadme flag of the [Files] section is used for this purpose, but you can read the ReadMe file, only if the computer does not restart after installation.


It is an optional section that defines which records will be added to the INI file. If the INI file with the specified name does not exist in the specified folder, the installer will create it. If the INI file already exists, it can add, delete or modify entries in it, as well as delete the existing INI file and create a new one with the same name, but with different content.


infoafter.txt is copied into your app_dir by copy_installation via create_app. If you would like to customize the message your users see at the end of your installer, add the name of a .txt or .rtf file to the info_after arg of create_app and edit the document accordingly.


You can specify folder-name\* to get all files in the folder. You don't have to specify each file separately.I think you've gone overboard with the defines and actually made it more complex. My setup files are between 25 and 50 lines.What is the purpose of renaming the uninstall program? Won't that actually prevent it from working? When you run an install, Windows records the name of the uninstaller in the registry.


If you're trying to delete temporary files (eg. needed by a subinstall): Anything you install to tmp will automatically be deleted at the end of the install. If you cant' install to tmp for some reason then you can use the deleteafterinstall flag on the [Files] entry.


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.


To run an uninstaller built in Inno Setup without any window, use /VERYSILENT command-line parameter: When specified, the uninstaller will not ask the user for startup confirmation or display a message stating that uninstall is complete. Shared files that are no longer in use are deleted automatically without prompting.


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.


From inno setup help it will uninstall only if it's empty, so it won't work: uninsalwaysuninstall Instructs the uninstaller to always attempt to delete the directory if it's empty. Normally the uninstaller will only try to delete the directory if it didn't already exist prior to installation. Add delete file/folder item in Inno Setup studio.


The .iss file is the Inno Setup script. To edit this file you need to install Inno Setup, which comes with its own script editor. This same editor will be used to compile the new installer at the end of the tutorial. I prefer to edit the scripts in Notepad++, my favorite text editor. Download my custom installer here.


[iss][Setup]AppName=Freemake Video ConverterAppVersion=4.0.2DefaultDirName=pf\FreemakeDefaultGroupName=FreemakeUninstallDisplayIcon=app\Freemake Video Converter\Uninstall\icon.ico; Using an icon for the setup fileSetupIconFile=app\Freemake Video Converter\Uninstall\icon.icoUninstallFilesDir=app\Freemake Video Converter\UninstallOutputBaseFilename=Freemake Video Converter 4.0.2.9Compression=lzma2DisableProgramGroupPage=yesWizardImageFile=embedded\WizardImage.bmpWizardSmallImageFile=embedded\WizardSmallImage.bmp[/iss] 2ff7e9595c


1 view0 comments

Recent Posts

See All

Comments


bottom of page