Inno Setup return 只有用户指定的命令行开关

Inno Setup return only user specified command line switches

支持函数GetCmdTail returns 所有命令行参数作为单个字符串传递给安装程序或卸载程序。这会产生:

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

是否有其他功能或简单的方法来返回用户指定的命令行开关:

/verysilent /suppressmsgboxes /closeapplications /restartapplications /norestart

在这种特殊情况下,在排除 /DEBUGWND 条目的同时 and/or 没有用户指定的任何其他参数?

从 Inno Setup 6.2 开始,ParamCount and ParamStr exclude some of these internal parameters,因此不需要下面代码中的 if 条件。*


基于我用于 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;