Parameters inno从代码中传递多个变量以运行
如何将两个变量从[Code]部分传递到Inno设置中[Run]部分的参数 基本上,我想做以下几点Parameters inno从代码中传递多个变量以运行,parameters,inno-setup,Parameters,Inno Setup,如何将两个变量从[Code]部分传递到Inno设置中[Run]部分的参数 基本上,我想做以下几点 获取路径并将用户输入保存到过程InitializeWizard中的变量 获取文件及其完整路径,并将用户输入保存到第二个InitializeWizard过程中的第二个变量 在[Run]部分中,将用户输入的第一个路径和文件及其路径传递给批处理文件 我真的不知道如何将其放入inno脚本: [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{c
- 获取路径并将用户输入保存到过程InitializeWizard中的变量
- 获取文件及其完整路径,并将用户输入保存到第二个InitializeWizard过程中的第二个变量
- 在[Run]部分中,将用户输入的第一个路径和文件及其路径传递给批处理文件
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent; Parameters: "{code:GetBatchParams GetBatchParams2}"
[Code]
var
DirInputPage: TInputDirWizardPage;
DirInputPage2: TInputDirWizardPage;
function GetBatchParams(Value: string): string;
begin
Result := DirInputPage.Values[0];
end;
procedure InitializeWizard;
begin
DirInputPage := CreateInputDirPage(wpWelcome, 'Set Oracle kit path', '',
'', False, '');
DirInputPage.Add('Choose the location of Database folder as extracted from Oracle kit archives:');
DirInputPage.Values[0] := ExpandConstant('{src}');
end;
function GetBatchParams2(Value: string): string;
begin
Result := DirInputPage2.Values[0];
end;
procedure InitializeWizard2;
begin
DirInputPage := CreateInputDirPage(wpWelcome, 'Set qpay interface path', '',
'', False, '');
DirInputPage.Add('Choose the location of ear file:');
DirInputPage.Values[0] := ExpandConstant('{src}');
end;
谢谢
编辑:
我做了一些修改以反映我的需要(一个文件夹,一个文件)。我不知道如何将它们作为可执行文件的参数传递(我不知道如何编写代码指令以使安装程序启动这两个向导)
只需在一个getter中将它们连接成一个字符串。谢谢,也许我没有说清楚:这些变量是两个不同的东西,一个表示文件夹的位置,另一个表示.ear文件的位置。第一个用于数据库的静默安装,另一个用于webpshere中接口的静默安装。但它们只指定一个复杂的命令行参数。好吧,如果你真的想这样做,那么就使用
参数:“{code:GetBatchParams}{code:GetBatchParams2}”
,但在我看来这是误导性的,我会在一个getter中连接所有这些参数(从中可以调用所有这些子函数并连接它们,例如使用格式
函数).我制作了一个函数,其中两个参数都是从用户输入读取的,但现在我必须将它们串联起来,以便一个接一个地传递它们(包括它们之间的空格)。类似于结果:=DirInputPage.Values[0]“”FileInputPage.Values[0];有什么提示我该怎么做吗?别猜,测试。尤其是对包含空格的路径进行测试,因为@TLama说您几乎肯定需要引用这些空格。
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent; Parameters: "{code:GetBatchParams GetBatchParams2}"
[Code]
var
DirInputPage: TInputDirWizardPage;
FileInputPage: TInputFileWizardPage;
function GetBatchParams(Value: string): string;
begin
Result := DirInputPage.Values[0];
end;
procedure InitializeWizard;
begin
DirInputPage := CreateInputDirPage(wpWelcome, 'Set Oracle kit path', '', '', False, '');
DirInputPage.Add('Choose the location of Database folder as extracted from Oracle kit archives:');
DirInputPage.Values[0] := ExpandConstant('{src}');
end;
function GetBatchParams2(Value: string): string;
begin
Result := FileInputPage.Values[0];
end;
procedure InitializeWizard;
begin
FileInputPage := CreateInputFilePage(wpWelcome, 'Set qpay interface path', 'where is war', '');
FileInputPage.Add('Location of ear file:', 'Executable files|*.ear|All files|*.*', '.ear');
end;