1

I've tried used the "/silent" parameter in Icons section like:

Name: "{group}\{code:GetUninstallExeNa}"; Filename: "{app}\unins000.exe"; Parameters:"/SILENT /log";

It did work when I Uninstall from the Start Menu even from control panel's applet. But it still show the confirm uninstall prompt when I double click the unins000.exe in the install directory.

I also tried to append the parameters "/SILENT /log" to the UninstallString in the registry. But it will still show the prompt when I run the unins000.exe from install directory directly.

Any advice?

XHLin
  • 301
  • 1
  • 3
  • 13
  • It doesn't work from Control Panel ``appwiz.cpl` as it takes data from Registry, not from Start Menu shortcut. You would have to modify Registry entry for that file after the installation. – RobeN Jan 12 '17 at 09:02

1 Answers1

0

You could change the UninstallString for your application in the Registry to always run in Silent mode.

[Code]
procedure ChangeUninstallString;
var
  sUnInstPath: String;
  sUnInstallString: String;
begin
  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  sUnInstallString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then begin
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
    RegWriteStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString + '/SILENT');
  end
  else begin
    RegWriteStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString + '/SILENT');
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin  
  if CurStep=ssDone then begin
   ChangeUninstallString;
  end;
end; 
RobeN
  • 5,346
  • 1
  • 33
  • 50
  • It seems doesn't work in my program. What I need is to run the uninstall in silent mode when I double-click the unins000.exe file. – XHLin Jan 12 '17 at 09:56
  • @XHLin That's not possible, without re-compiling Inno Setup. Anyway, why do you need this? – Martin Prikryl Jan 12 '17 at 10:08
  • @MartinPrikryl Cause I already have my own custom page to notify user confirm to uninstall the program. So I want to hide this build-in prompt. – XHLin Jan 12 '17 at 10:15
  • OK, but why do you bother about user clicking the `unins000.exe`? It's unlikely. – Martin Prikryl Jan 12 '17 at 10:18
  • It is a normal scene that users uninstall my program by running the unins000.exe. If so, I need to hide the build-in prompt. – XHLin Jan 13 '17 at 02:52
  • I do not think so. Most users do not venture to "Program Files" at all. – Martin Prikryl Jan 13 '17 at 06:44
  • The default way of Uninstallation is via `appwiz.cpl` (Control Panel => Programs and Features) or via Start Menu (for WIndows XP and less for Vista/7). But... if you really need, you can always place unins000.exe in Subdirectory of your App (and even set it as Hidden/System) and add your own small Executable that will run real uninstaller with parameter. – RobeN Jan 13 '17 at 08:35
  • Or you can prevent the manual execution of the uninstaller by introducing a hidden switch. See http://stackoverflow.com/q/34126752/850848 – Martin Prikryl Mar 02 '17 at 07:03