如何使Inno Setup/DIR命令行开关与自定义路径页面一起使用 [英] How to make Inno Setup /DIR command line switch work with custom path page
问题描述
当我使用/DIR
命令行开关
"Mysoft.exe" /VERYSILENT /installerbusiness /DIR="C:\Program Files (x86)"
指定的路径未用于我的自定义页面上的路径框:
我正在使用基于在文件"部分的自定义页面中使用两个/多个选定目录的代码.
>这是我正在使用的代码的示例.
[Code]
var
Install: TInputDirWizardPage;
procedure InitializeWizard();
begin
Install :=
CreateInputDirPage(
wpSelectDir, CustomMessage('Readyinstall'),
CustomMessage('Readyinstallpc'), #13#10#13#10 + CustomMessage('Tocontinuet'),
True, 'Mysoft');
Install.Add(CustomMessage('DestFolder'));
Install.Values[0] := ('C:\Program Files\Mysoft');
{ ... }
end;
如果您想要Inno Setup的安装路径"的标准行为,其中包括对 为补充上面的代码,您应该将值复制回 如果由于安装程序的逻辑复杂而导致上述操作过于复杂(或不太明显),则您可以自己以编程方式处理 此解决方案显然无法处理 此外,使用此解决方案,以前使用的安装路径将不会用于升级/重新安装. 带有三个目标文件夹的Inno设置中显示的实现方式. When I use / The specified path does not get used for path box on my custom page : I'm using code based on Use two/multiple selected directories from custom page in Files section. This is an example of the code I'm using.
If you want the standard behavior of "installation path" of Inno Setup, which includes the processing of So particularly, you have to copy the initial value of the This solution handles not only To complement the code above, you should copy the value back to If the above is too complicated (or not obvious) to implement, because of a complex logic of your installer, you can handle the This solution obviously does not handle Also, with this solution, the previously used installation path won't be used for upgrades/re-installs. How to implement that is shown in Inno Setup with three destination folders. 这篇关于如何使Inno Setup/DIR命令行开关与自定义路径页面一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!var
Page: TInputDirWizardPage;
procedure InitializeWizard();
begin
...
Page := CreateInputDirPage(...);
Page.Add(...);
Page.Values[0] := WizardForm.DirEdit.Text;
end;
WizardForm.DirEdit
.这样,您可以确保在重新安装/升级时,可以重新使用先前选择的值.这显示在我对在文件"部分的自定义页面中使用两个/多个选定目录的答案的第1点).. >
/DIR=
开关.请参见通过命令行设置Inno Setup自定义页面字段的值.
procedure InitializeWizard();
var
DirSwitchValue: string;
begin
Install := ...;
Install.Add(...);
DirSwitchValue := ExpandConstant('{param:DIR}');
if DirSwitchValue <> '' then
begin
Install.Values[0] := DirSwitchValue;
end
else
begin
Install.Values[0] := ExpandConstant('{pf}\Mysoft');
end;
end;
/LOADINF=
. Inno Setup中显示了如何处理.inf
文件的方法.从文件(.inf)加载自定义安装设置的默认设置以进行静默安装.DIR
command line switch"Mysoft.exe" /VERYSILENT /installerbusiness /DIR="C:\Program Files (x86)"
[Code]
var
Install: TInputDirWizardPage;
procedure InitializeWizard();
begin
Install :=
CreateInputDirPage(
wpSelectDir, CustomMessage('Readyinstall'),
CustomMessage('Readyinstallpc'), #13#10#13#10 + CustomMessage('Tocontinuet'),
True, 'Mysoft');
Install.Add(CustomMessage('DestFolder'));
Install.Values[0] := ('C:\Program Files\Mysoft');
{ ... }
end;
/DIR=
command-line switch, you have to link your custom path box to the standard one.WizardForm.DirEdit
to your custom box:var
Page: TInputDirWizardPage;
procedure InitializeWizard();
begin
...
Page := CreateInputDirPage(...);
Page.Add(...);
Page.Values[0] := WizardForm.DirEdit.Text;
end;
/DIR=
, but also /LOADINF=
.WizardForm.DirEdit
. This way you make sure that on re-install/upgrade, the previously selected value is reused. This is shown in point 1) of my answer to Use two/multiple selected directories from custom page in Files section.
/DIR=
switch programmatically yourself. See Setting value of Inno Setup custom page field from command-line.procedure InitializeWizard();
var
DirSwitchValue: string;
begin
Install := ...;
Install.Add(...);
DirSwitchValue := ExpandConstant('{param:DIR}');
if DirSwitchValue <> '' then
begin
Install.Values[0] := DirSwitchValue;
end
else
begin
Install.Values[0] := ExpandConstant('{pf}\Mysoft');
end;
end;
/LOADINF=
. How to process .inf
files is shown in Inno Setup Load defaults for custom installation settings from a file (.inf) for silent installation.