InnoSetup,如何在向导中打开用户指定的端口?

San*_*urg 1 inno-setup windows-firewall wizard

在 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;
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

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

或者如果我()在通话时挂断电话

“GetServerPort”原型无效

mir*_*eil 5

这段代码对我有用:

[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 Online (Sandbox Code Playgroud)

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


归档时间:

查看次数:

1834 次

最近记录:

2 年,3 月 前