How to open range of ports on Windows XP / 2003 Firewall

Manually opening range of port can be very painful if you must open a big range of ports. It can be easily done with the following script from command prompt:

FOR /L %I IN (5000,1,5010) DO netsh firewall add portopening TCP %I “Passive FTP”%I

This will open ports from 5000 to 5010.

FOR /L %I IN (5000,1,5010) DO netsh firewall delete portopening TCP %I

Thiss will close ports from 5000 to 5010.

Leave a comment