1
votes

The support function GetCmdTail returns all command line parameters passed to Setup or Uninstall as a single string. This produces:

/SL5="$A808E8,550741730,269824,D:\Setup.exe" /DEBUGWND=$6A0ACA /verysilent /suppressmsgboxes /closeapplications /restartapplications /norestart

Is there another function or simple way of just returning the user specified command line switches:

/verysilent /suppressmsgboxes /closeapplications /restartapplications /norestart

in this particular case, whilst excluding the /DEBUGWND entry and/or any other parameters that have not been user specified?

1

1 Answers

2
votes

Since Inno Setup 6.2, ParamCount and ParamStr exclude some of these internal parameters, so the if condition in the below code is not needed.*


Based on a similar code I use to run an elevated installer:

function GetUserCmdTail: string;
var
  I: Integer;
  S: string;
begin
  for I := 1 to ParamCount do
  begin
    S := ParamStr(I);
    { Filter all internal Inno Setup switches }
    if (CompareText(Copy(S, 1, 5), '/SL5=') <> 0) and
       (CompareText(Copy(S, 1, 10), '/DEBUGWND=') <> 0) and
       (CompareText(Copy(S, 1, 10), '/SPAWNWND=') <> 0) and
       (CompareText(Copy(S, 1, 11), '/NOTIFYWND=') <> 0) and
       (CompareText(S, '/DETACHEDMSG') <> 0) and
       (CompareText(S, '/DebugSpawnServer') <> 0) then
    begin
      Result := Result + AddQuotes(S) + ' ';
    end;
  end;
end;