Q:

Inno Setup return only user specified command line switches

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?

A:

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;

