Add Ports to Windows Firewall
By ET
To add a range of ports to Windows Firewall from the Command Line
- Start Command Line
- Type in the following where the range is specified in ( ) and the name of the firewall entry is in ” “.
FOR /L %I IN (5001,1,5010) DO netsh firewall add portopening TCP %I “PassiveFTP”%I - Each port in the range will be added with an “OK” confirmation.

May 9th, 2008 at 8:18 pm
I found this incredibly useful for setting up passive ftp with the 2003 server and windows firewall. Thanks very much
Am I right in thinking that i can substitute portopening for portclosing and have the opposite effect? Or is it more complicated than that?
March 5th, 2008 at 9:14 pm
Haven’t written anything for two months. This is crazy.