There are many different types of firewall rules which can be controlled using “NETSH ADVFIREWALL FIREWALL”.  It replaced the old “netsh firewall” which was available in Windows XP and earlier.

To add a firewall rule in Windows using the command line to open a specific incoming port enter the following command:

netsh advfirewall firewall add rule name=”Open Port XXXX” dir=in action=allow protocol=TCP localport=XXXX

where XXXX is the TCP port you wish to open

More information on the different uses for “netsh advfirewall firewall” can be found at the following Microsoft Support Article here.

Note: The command prompt must be Run as Administrator