Inno Setup customizing the script for uninstalling file names

Source: Internet
Author: User

Inno Setup supports installing multiple applications in the same directory, so the uninstaller files are automatically named Unins000.exe,unins001.exe,unins002.exe and so on according to the order in which they are installed. This is the function of Inno SETUP itself. See Http://www.jrsoftware.org/iskb.php?uninstallername.

Once the installation process is complete, you can of course change the name of the uninstall file to any other file name, noting that you want to change the Unins00X.exe and Unins00X.dat in the installation directory as well as the relevant uninstallation information in the registry. Because the actual location and name of the uninstaller file can be represented by the constant {Uninstallexe}, you can have your installer automatically make these changes, as shown in the sample script.

The following is the quoted content:; Inno Setup Script
; The sample script shows how to customize the name of the unload file (default is Unins000.exe,unins001.exe, and so on).
[Setup]
Appname= Custom Uninstall file name sample program
Appvername= Custom Uninstall File name Example Program 1.0
defaultdirname={pf}/Custom Uninstall file name sample program
Defaultgroupname= Custom Uninstall file name sample program
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "Myprog.hlp"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"
[CODE]
Procedure curstepchanged (Curstep:tsetupstep);
Var
Uninspath, Uninsname, Newuninsname, myappname:string;
Begin
If Curstep=ssdone Then
Begin
Specify a new Uninstall file name (with no extension), modify it accordingly!
Newuninsname: = ' unload ';
The application name, and the [SEUTP] segment of the AppName must be the same, please modify the corresponding!
Myappname: = ' Custom uninstall file name sample program ';
Rename the uninstall file below
uninspath:= Extractfilepath (Expandconstant (' {uninstallexe} '));
uninsname:= Copy (Extractfilename (Expandconstant (' {uninstallexe} ')), 1,8);
RenameFile (Uninspath + uninsname + '. exe ', Uninspath + newuninsname + '. exe ');
RenameFile (Uninspath + uninsname + '. Dat ', Uninspath + newuninsname + '. dat ');
Modify the appropriate registry content as follows
If Regkeyexists (HKEY_LOCAL_MACHINE, ' software/microsoft/windows/currentversion/uninstall/' + MyAppName + ' _is1 ') then
Begin
Regwritestringvalue (HKEY_LOCAL_MACHINE, ' software/microsoft/windows/currentversion/uninstall/' + MyAppName + ' _is1 ' , ' uninstallstring ', ' "' + Uninspath + newuninsname + '. exe ');
Regwritestringvalue (HKEY_LOCAL_MACHINE, ' software/microsoft/windows/currentversion/uninstall/' + MyAppName + ' _is1 ' , ' quietuninstallstring ', ' "' + Uninspath + newuninsname + '. exe"/silent ');
End
End
End

Inno Setup to customize the script for uninstalling file names

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.