Inno Setup Scripted Constants in uninstaller

To use the [UninstallRun] section, you have to know the path on the install time. As the constants in all sections are resolved on the install time.

If you do not know the path on install time, you have to use Pascal Script event function CurUninstallStepChanged. In the function, you can resolve the paths using Reg* support functions. Probably using RegQueryStringValue. Then you can execute the found binary using the Exec function.

[Code]

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
  Path: string;
begin
  if CurUninstallStep = usUninstall then
  begin
    if RegQueryStringValue(..., ..., ..., Path) then
    begin
      Log(Format('Executing %s...', [Path]));
      Exec(Path, ...);
    end;
  end;
end;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top