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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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 96

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

687 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