I want to know, if there is a way to add some command line parameters to Inno Setup based installer for /VERYSILENT
mode, if for example I have theses checks:
Source: "{app}\Portable-File.exe"; DestDir: "{app}"; MinVersion: 0.0,5.0; Check: install1;
Source: "{app}\Installer-File.exe"; DestDir: "{app}"; MinVersion: 0.0,5.0; Check: porta1;
And I have these lines based in my two examples checks:
"MyProgram.exe" /VERYSILENT /install1 /EN
"MyProgram.exe" /VERYSILENT /porta1 /EN
Implement the install1
and porta1
functions like:
function HasCommandLineSwitch(Name: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ParamCount do
begin
if CompareText(ParamStr(I), '/' + Name) = 0 then
begin
Result := True;
Break;
end;
end;
end;
function install1: Boolean;
begin
Result := HasCommandLineSwitch('install1');
end;
function porta1: Boolean;
begin
Result := HasCommandLineSwitch('porta1');
end;
You can actually use the HasCommandLineSwitch
directly in the Check
parameter:
[Files]
Source: "Portable-File.exe"; DestDir: "{app}"; Check: HasCommandLineSwitch('install1')
Source: "Installer-File.exe"; DestDir: "{app}"; Check: HasCommandLineSwitch('porta1')
Though I assume that your install1
and porta1
function will actually do more than just call HasCommandLineSwitch
, so this is probably not applicable to you.
Actually, as I know that you have checkboxes that correspond to install1
and porta1
, what you really want to do, is to check those checkboxes, when the installer is starting, if the switches are specified. This way you can use /install1
and /porta1
to set default values, even if not used in combination with /verysilent
. And it will still work even in the /verysilent
more, even though the user will actually never see the checkboxes (they are still present, even though not visible)
install1 := TNewRadioButton.Create(WizardForm);
install1.Checked := HasCommandLineSwitch('install1');
porta1 := TNewRadioButton.Create(WizardForm);
porta1.Checked := HasCommandLineSwitch('porta1');
And you keep your install1
and porta1
function to return the state of the checkboxes, as seen in Inno Setup Set Uninstallable directive based on custom checkbox value.