Geeks With Blogs
Derek Meier Geocentric Forensics

Another quick post!

I am a frequent traveler, and as such I like to be able to turn on (or off) my Windows firewall quickly.  The Windows firewall in Windows XP isn't perfect, but I would suggest using it or something else whenever connecting to public WIFI. 

Here is the script I use, which simply prompts you if you want your firewall on or off and uses NETSH to accomplish the task:

@echo off
color 0a
cls
:local_question
echo.
echo Do you want to enable or disable the firewall?
echo.
echo           ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»  ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo           º A. Enable       º  º B. Disable      º            
echo           ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ  ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
set localchoice=
set /p localchoice= Press A for enable or B for disable:
if not '%localchoice%'=='' set finalchoice=%finalchoice:~0,1%
if '%localchoice%'=='A' goto start
if '%localchoice%'=='a' goto start
if '%localchoice%'=='B' goto stop
if '%localchoice%'=='b' goto stop
@ECHO.
@ECHO "%localchoice%" is not valid please try again
goto local_question

:stop

netsh firewall set opmode disable
goto end

:start
netsh firewall set opmode enable
goto end

:end
echo The End.
ping 127.0.0.1 > nul
exit

 

Have a good start to November!

-Derek

Posted on Monday, November 1, 2010 11:47 AM | Back to top


Comments on this post: Quick DOS batch file to turn on or off the Windows firewall.

Comments are closed.
Comments have been closed on this topic.
Copyright © Derek Meier | Powered by: GeeksWithBlogs.net