我已经配置了下面的脚本来要求用户输入IP地址作为安装向导的一部分,该地址被写入应用程序将引用的配置文件知道在哪里沟通。我想提供机会在命令行中将此IP地址指定为参数,以便部署可以自动执行并以静默方式执行。从命令行设置Inno Setup自定义页面字段的值
从我的研究中,似乎可以添加一个命令行参数,但我很难理解如何在Inno安装程序中设置此设置,然后如何使此选项可以在其上指定命令行或通过安装向导。
例如像app1.exe /ipaddress 192.168.0.1
道歉,如果这是一个简单的过程,我是新来的Inno Setup的所以任何帮助,将不胜感激。
任何人都可以提供任何帮助来帮助我得到这个设置?
[Code]
var
PrimaryServerPage: TInputQueryWizardPage;
function FileReplaceString(ReplaceString: string):boolean;
var
MyFile : TStrings;
MyText : string;
begin
Log('Replacing in file');
MyFile := TStringList.Create;
try
Result := true;
try
MyFile.LoadFromFile(ExpandConstant('{app}' + '\providers\win\config.conf'));
Log('File loaded');
MyText := MyFile.Text;
{ Only save if text has been changed. }
if StringChangeEx(MyText, 'REPLACE_WITH_CUSTOMER_IP', ReplaceString, True) > 0 then
begin;
Log('IP address inserted');
MyFile.Text := MyText;
MyFile.SaveToFile(ExpandConstant('{app}' + '\providers\win\config.conf'));
Log('File saved');
end;
except
Result := false;
end;
finally
MyFile.Free;
end;
Result := True;
end;
procedure InitializeWizard;
begin
PrimaryServerPage :=
CreateInputQueryPage(
wpWelcome, 'Application Server Details', 'Where is installed?',
'Please specify the IP address or hostname of your ' +
'Primary Application Server, then click Next.');
PrimaryServerPage.Add('Primary Application Server IP/Hostname:', False);
end;
procedure ReplaceIPAddress;
begin
FileReplaceString(PrimaryServerPage.Values[0]);
end;