【问题标题】:Inno Setup return only user specified command line switchesInno Setup 仅返回用户指定的命令行开关
【发布时间】:2016-06-17 03:40:14
【问题描述】:

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

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

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

/verysilent /suppressmsgboxes /closeapplications /restartapplications /norestart

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

【问题讨论】:

    标签: inno-setup pascalscript


    【解决方案1】:

    由于 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;
    

    【讨论】:

    • 谢谢马丁。完美运行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-17
    • 1970-01-01
    • 2011-12-17
    • 1970-01-01
    • 2011-04-06
    • 1970-01-01
    相关资源
    最近更新 更多