'Conditional Registry entries with Inno Setup

I want some registry entries to be written if two conditions are met:

  • the installer is running in silent mode and
  • I have some command line parameters present.

Is there a way to do this in the [Registry] section?

I have something similar in the [Run] section:

Filename: "{app}\AppWithParams.exe"; Parameters: "{code:BuildParams}"; \
   Flags: postinstall skipifsilent; \
   Description: "This program needs some parameters"
[Code]
function BuildParams(Param: string): string;
begin
  Result := Format('/p1="%s" /p2="%s" /p3="%s"', [
                      ExpandConstant('{param:p1|}'), 
                      ExpandConstant('{param:p2|}'),
                      ExpandConstant('{param:p3|}')]);
end;

I've seen that [Registry] entries can be made dependent of a [Task] but I need them only in silent mode so I think this approach won't serve me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source