- @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=1* delims= " %%i in ('netsh advfirewall firewall show rule name^=all dir^=in') do (
- if "%%i" == "规则名称:" (
- set "ruleName=%%j"
- ) else if "%%i%%j" == "本地端口:445" (
- echo;netsh advfirewall firewall set rule name="!ruleName!" new enable=no
- )
- )
- pause
复制代码
|