在 Windows 防火墙中打开端口涉及哪些 API 调用? [英] What API calls are involved in opening a port in the Windows Firewall?

查看:47
本文介绍了在 Windows 防火墙中打开端口涉及哪些 API 调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件,可以在大约 1 秒内安装 WinVNC 并启动服务.但是,我仍然必须手动进入 Windows 防火墙并打开一个端口以允许连接.我怎样才能以编程方式做到这一点?

I have a batch file that installs WinVNC in about 1 second and starts up the service. However, I still have to manually go into the Windows Firewall and open a port to allow connections. How can I do that programmatically?

如果我可以从批处理文件中完成,那将是理想的,但如果有必要,我可以编写一个 EXE.

If I could do it from inside the batch file, that would be ideal, but I'm ok writing an EXE if that's necessary.

推荐答案

Let me 谷歌搜索:
http://www.windowsecurity.com/articles/Customizing-Windows-Firewall.html

此页面包含多种自定义防火墙的方法,其中使用 netsh.exe 似乎可以通过命令行访问 Windows 防火墙.

This page includes a multitude of ways to customize the firewall, among those the use of netsh.exe that seem to give command line access to windows firewall.

这篇关于在 Windows 防火墙中打开端口涉及哪些 API 调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆