Search This Blog

Thursday, July 5, 2012

Windows 7/Vista PortForward issue

Hi there fellow members, as i have seen many of members are having trouble trying to portforward properly their ports on windows 7/vista OS even after following guide on portforwarding on router, i have made this batch script to make an exception in their firewalls. 

Note: I know you can do it without batch, but i thought this can be useful.

I've seen firewall is acting weird on these platforms for some reason, basically even if firewall is disabled it might block connections (I have had this problem with some guy last night and enabling firewall solved his issue - it's common "bug").

So, here's the batch script you need:

PHP Code:
@echo off
setlocal

:: Please select your port by editing it below
set PORTNUMBER=1604
:: Please do not touch anything below this

:: Enable firewall
netsh advfirewall set currentprofile state on
:: Enabled

:: Set Rule Name
set RULENAME=%PORTNUMBER%
:: Set

if "%1"=="" call :_OpenPort
goto :EOF
:_OpenPort
:: Open port on firewall:
netsh advfirewall firewall show rule name=%RULENAME% >nul
if not ERRORLEVEL 1 (
rem Rule %RULENAME% already exist.
echo I see that you already have this port open!
) else (
echo Rule %RULENAME% not exist. Creating new rule for you!
netsh advfirewall firewall add rule name=%RULENAME% dir=in action=allow protocol=TCP localport=%PORTNUMBER%
)
goto :EOF 
* Save it as *.bat  (PORT 1604)


All you have to do is to set port number you need to forward on line 5. of batch script :
Code:
set PORTNUMBER=1604
(by default it's 1604) and run it as administrator.
Hope you find this useful and helpful. Thanks for reading.



As i love portforwarding i'll do my best to write detailed tutorial on how to properly forward your port(s)

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

0 comments:

Post a Comment