Using global string script variable in Run section in Inno Setup

耗尽温柔 提交于 2019-12-18 07:12:30

问题


I need a global string variable in Inno Setup, that is going to be initialized in [Code] section and used in [Run] section.

Is this possible?


回答1:


You are probably looking for a 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;

For a more real-life example, see Use a part of a registry key/value in the Inno Setup script.



来源:https://stackoverflow.com/questions/33974745/using-global-string-script-variable-in-run-section-in-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!