InnoSetup,如何打开通过向导的用户给出的端口? [重复]

问题描述 投票:0回答:1

在innosetup安装,我的目标是配置Windows防火墙以打开足够的端口为我的软件

[Run]
Filename: "{sys}\netsh.exe"; Parameters: "firewall set portopening protocol=TCP port=""{code:GetServerPort()}"" name=NxTCP mode=ENABLE"; StatusMsg: "Opening TCP Port ""{code:GetServerPort()}"; Flags: runhidden

[Code]
function GetServerPort(): String;
begin
  Result := "5555"; //obtained with the Wizard
end;

而我得到这个错误

所需的函数或过程“GetServerPort()”未找到。

或者,如果我在掉话的()

无效的原型“GetServerPort”

inno-setup wizard windows-firewall
1个回答
2
投票

此代码的工作对我来说:

[Run]
Filename: "{sys}\netsh.exe"; Parameters: "firewall set portopening protocol=TCP port=""{code:GetServerPort}"" name=NxTCP mode=ENABLE"; StatusMsg: "Opening TCP Port ""{code:GetServerPort}"; Flags: runhidden


[Code]
function GetServerPort(Value: string): String;
begin
  Result := '5555'; //obtained with the Wizard
end;

[Run]你的函数调用的格式不正确。该{code:XXX}基本上是一个Check参数和http://www.jrsoftware.org/ishelp/topic_scriptcheck.htm被记录在案

© www.soinside.com 2019 - 2024. All rights reserved.