How to Close Ports
I’ve been looking for a while on just how to close a port on
a computer. I simply couldn't find a way. Well, I finally found it.
It's actually quite simple. Here's the command for it:
netsh firewall delete portopening TCP portnumber
Yes, It's really that simple. Simply go to START -> RUN
-> and type in that command up there(replace portopening with the port opening and portnumber with the port number), and it'll close it for you. Or,
you can also open up command prompt (START -> RUN -> CMD) and type in
"netsh" without the quotes to get to your windows firewall settings. However,
since I’m such a nice guy, i wrote it all out in a vbs script for you so that
it's automatically runnable as well as a batch script. So here you are fellas:
Copy this script into Notepad and save that file as
portcloser.VBS (remember to write .VBS in the filename). Then run the output
file as administrator and you’re done.
.VBS Script
set ss = createobject("wscript.shell")
set ws = wscript
dim PORT
PORT = InputBox("Enter the port you wish to
close:")
ss.run "netsh.exe"
ws.sleep 1000
ss.sendkeys "firewall delete portopening TCP "
& PORT
ss.sendkeys "{enter}"
ws.sleep 500
'ss.sendkeys "exit"
'ss.sendkeys "{enter}"
Or, you can copy
this code into notepad and save it as portcloser.BAT (remember to write .VBS in
the filename). Again, run the output file as admin.
.BAT Script
@echo off
title Port Closer
echo Port Closer
echo.
set /p port=Type the port number you wish to close here:
netsh firewall delete portopening TCP %port%
msg /w * Port %port% has been closed.
exit
No comments:
Post a Comment