@echo off setlocal enabledelayedexpansion set "IPLIST=blacklist.txt" for /f "usebackq delims=" %%i in ("%IPLIST%") do ( set "ip=%%i" netsh advfirewall firewall add rule name="Block_!ip!" dir=in action=block remoteip="!ip!" ) echo 完成。