我已經配置了下面的腳本來要求用戶輸入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;