InnoSetup,如何在向导中打开用户给定的端口?
InnoSetup, How to open a port given through the user in 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;
我收到这个错误
Required function or procedure 'GetServerPort()' not found.
或者如果我在通话时挂断 ()
Invalid prototype for 'GetServerPort'
这段代码对我有用:
[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
在 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;
我收到这个错误
Required function or procedure 'GetServerPort()' not found.
或者如果我在通话时挂断 ()
Invalid prototype for 'GetServerPort'
这段代码对我有用:
[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