100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > inno setup 卸载注册表_inno setup 修改卸载文件名称

inno setup 卸载注册表_inno setup 修改卸载文件名称

时间:2020-04-02 14:51:51

相关推荐

inno setup 卸载注册表_inno setup 修改卸载文件名称

; Inno Setup 脚本

; 该示例脚本显示如何自定义卸载文件的名称(默认为 unins000.exe,unins001.exe 等等)。

[Setup]

AppName=自定义卸载文件名示例程序

AppVerName=自定义卸载文件名示例程序 1.0

DefaultDirName={pf}\自定义卸载文件名示例程序

DefaultGroupName=自定义卸载文件名示例程序

[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

// 指定新的卸载文件名(不包含扩展名),请相应修改!

NewUninsName := '卸载';

// 应用程序名称,与 [SEUTP] 段的 AppName 必须一致,请相应修改!

MyAppName := '自定义卸载文件名示例程序';

// 以下重命名卸载文件

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');

// 以下修改相应的注册表内容

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;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。