Programmatically opening a port on Windows with a script.

Posted on 2008-10-27
Last Modified: 2012-08-13
I have an application that communicates on a port via TCP/IP and I want the user to be able to run a batch file that will open a specified port through the Windows Firewall.  I am unsure as to what I need to do.  Please let me know.


Question by:FreightTrain

Accepted Solution

siranm earned 500 total points
ID: 22817017

this should get you going:

for example: command: netsh firewall set portopening TCP 80 http

i got it from

which led me to:
LVL 95

Expert Comment

by:Lee W, MVP
ID: 22817081

Author Closing Comment

ID: 31510529
Perfect Solution.  Thank you so much!  I didn't realize something like this would be so easy!!!  

Expert Comment

ID: 22817182
all = TCP + UDP ; change to need
10550 port change to port needed
TEST - chnage to Exceptions Name

Add this to your batch file
netsh firewall set portopening all 10550 TEST ENABLE

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
laptop estate analysis 5 63
Identify files for which names are too long 7 41
Malware Exploit 5 88
Microsoft Surface -- Factory Reset ? 5 18
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now