Inno setup 卸载后执行命令

Inno setup 卸载后执行命令,inno-setup,Inno Setup,我需要卸载以在删除已安装的文件后运行命令。 据我所知,[UninstallRun]在删除文件之前运行,没有任何用处。 我需要一面“姿态竖立”的旗帜 关于如何完成上述工作,有什么建议吗?请参阅文档中的“”。例如,当'CurUninstallStep'为'usPostUninstall'时,您可以使用此选项。同样,有一个[Run]节,Inno允许您定义一个节,以指定应在unistall上执行安装程序包的哪些文件 例如: [UninstallRun] Filename: {app}\Scripts\D

我需要卸载以在删除已安装的文件后运行命令。 据我所知,[UninstallRun]在删除文件之前运行,没有任何用处。 我需要一面“姿态竖立”的旗帜


关于如何完成上述工作,有什么建议吗?

请参阅文档中的“”。例如,当'CurUninstallStep'为'usPostUninstall'时,您可以使用此选项。

同样,有一个[Run]节,Inno允许您定义一个节,以指定应在unistall上执行安装程序包的哪些文件

例如:

[UninstallRun]
Filename: {app}\Scripts\DeleteWindowsService.bat; Flags: runhidden;
或者,@Sertac-Akyuz提出的利用事件函数的解决方案也可以用于调整更多的未安装操作。下面是在其他相关函数中使用curunnstallstepchanged函数的示例


@如果这解决了你的问题,你应该接受答案-用答案旁边的大勾/复选标记。哦,对不起,这是我的第一个问题。向Mark致意。无需担心-我可以从您的个人资料中看出您是该网站的新手。OP明确表示,由于安装顺序的原因,
[UninstallRun]
不适合。
; -- UninstallCodeExample1.iss --
;
; This script shows various things you can achieve using a [Code] section for Uninstall

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output

[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme

[Code]
function InitializeUninstall(): Boolean;
begin
  Result := MsgBox('InitializeUninstall:' #13#13 'Uninstall is initializing. Do you really want to start Uninstall?', mbConfirmation, MB_YESNO) = idYes;
  if Result = False then
    MsgBox('InitializeUninstall:' #13#13 'Ok, bye bye.', mbInformation, MB_OK);
end;

procedure DeinitializeUninstall();
begin
  MsgBox('DeinitializeUninstall:' #13#13 'Bye bye!', mbInformation, MB_OK);
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  case CurUninstallStep of
    usUninstall:
      begin
        MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall is about to start.', mbInformation, MB_OK)
        // ...insert code to perform pre-uninstall tasks here...
      end;
    usPostUninstall:
      begin
        MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall just finished.', mbInformation, MB_OK);
        // ...insert code to perform post-uninstall tasks here...
      end;
  end;
end;