1
votes

I am trying to uninstall an application installed with Inno Setup from another Inno Setup installer. I am able to find the uninstall string from the registry but I am not able to execute it silently. I am using RemoveQuotes() function of Inno Setup as below:

RunProcess(RemoveQuotes(sUnInstallString), '/SILENT');

But it the uninstaller window is still visible.

Where RunProcess() method is given as:

function RunProcess(name : String; args : String) : Integer;
var
  path : String;
  dir : String;
  errorCode : Integer;
begin
  path := ExpandConstant(name);
  dir := ExtractFileDir(path);
  Log(' Running: ' + path + ' ' + args + ' ...');
  Exec(path, args, dir, SW_SHOWNORMAL, ewWaitUntilTerminated, errorCode);
  if errorCode = 0 then
    Log(' Succeeded.')
  else
    Log(' Failed. Error Code: ' + IntToStr(errorCode));
    
  Result := errorCode;
end;
1

1 Answers

2
votes

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. Any critical error messages will still be shown on the screen. When '/VERYSILENT' is specified, the uninstallation progress window is not displayed.

If a restart is necessary and the '/NORESTART' command isn't used (see below) and '/VERYSILENT' is specified, the uninstaller will reboot without asking.


You may also consider using /SUPPRESSMSGBOXES parameter.