use a var in [RUN] section

2019-08-13 11:44发布

i wish to read a var value in [RUN] section, kets say this is my code -

[Setup]

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion

[Run]
Filename: "{app}\MyProg.exe"; Description: ""; parameters:"/setid=SessionIDValue"

[code]
var

    SessionIDValue: String;

procedure InitializeWizard();

  begin

    SessionIDValue:= 'test';

    end;

Is it possible to pass SessionIDValue value to parameters:"/setid=SessionIDValue"

10X FOR THE HELP

标签: inno-setup
1条回答
贼婆χ
2楼-- · 2019-08-13 12:38

You can write a scripted {code:...} constant getter function to bridge the [Code] section with scripting sections, e.g.:

[Run]
Filename: "{app}\MyProg.exe"; Parameters: "{code:GetSessionID}"

[Code]
var
  SessionID: string;

function GetSessionID(Param: string): string;
begin
  Result := SessionID;
end;
查看更多
登录 后发表回答