一键端口关闭

以下文本复制到txt,改后缀为bat,右键管理员运行即可。

%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
@echo off
color 1f
title 关闭135 137 138 139 445 3389端口
echo.
echo.
echo.
echo 正在关闭135-139端口 请稍候…
netsh advfirewall firewall add rule name = "Disable port 135-139 - TCP" dir = in action = block protocol = TCP localport = 135-139
echo.
netsh advfirewall firewall add rule name = "Disable port 135-139 - UDP" dir = in action = block protocol = UDP localport = 135-139
echo.
echo 正在关闭445端口 请稍候…
netsh advfirewall firewall add rule name = "Disable port 445 - TCP" dir = in action = block protocol = TCP localport = 445
echo.
netsh advfirewall firewall add rule name = "Disable port 445 - UDP" dir = in action = block protocol = UDP localport = 445
echo.
echo 正在关闭3389端口 请稍候…
netsh advfirewall firewall add rule name = "Disable port 3389 - TCP" dir = in action = block protocol = TCP localport = 3389
echo.
netsh advfirewall firewall add rule name = "Disable port 3389 - UDP" dir = in action = block protocol = UDP localport = 3389
echo.
echo 按任意键退出
pause>nul

 

注:bat文件百度云链接:

链接:https://pan.baidu.com/s/1QqbAFc0KIEfwZ1BbUrEgkA
提取码:6zmu

转载于:https://www.cnblogs.com/tan80000/p/11571422.html

你可能感兴趣的:(一键端口关闭)