【问题标题】:Using global string script variable in Run or other section in Inno Setup在 Inno Setup 的 Run 或其他部分使用全局字符串脚本变量
【发布时间】:2015-11-28 18:16:44
【问题描述】:

我在 Inno Setup 中需要一个全局字符串变量,它将在 [Code] 部分中初始化并在 [Run] 部分中使用。

这可能吗?

【问题讨论】:

    标签: inno-setup pascalscript


    【解决方案1】:

    您可能正在寻找scripted constant

    [Run]
    Filename: "{app}\MyProg.exe"; Parameters: "{code:GetGlobalVariable}"
    
    [Code]
    
    var
      GlobalVariable: string;
    
    function GetGlobalVariable(Param: string): String;
    begin
      Result := GlobalVariable;
    end;
    
    function InitializeSetup(): Boolean;
    begin
      GlobalVariable := '/parameter';
    
      Result := True;
    end;
    

    有关更真实的示例,请参阅Use a part of a registry key/value in the Inno Setup script

    【讨论】:

    • 这正是我想要的!非常感谢!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-17
    • 2019-03-28
    • 2011-01-01
    • 2013-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多