How to cut my Internet connection using DOS commands?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
budhax
Posts: 63
Joined: 09 Oct 2006 12:25

How to cut my Internet connection using DOS commands?

#1 Post by budhax » 17 Aug 2008 23:13

1.a How to cut my Internet connection using DOS commands?
After those commands:
netsh firewall delete portopening TCP 80
netsh firewall delete allowedprogram program = "C:\Program Files\Mozilla Firefox\firefox.exe"
I was still connected to Internet!!

1.b How to reverse action 1.a using DOS command(s)?

2. Which Windows service(s) should I stop to cut my Internet connection?
Thanks

Skeletor
Posts: 3
Joined: 01 Sep 2008 12:50
Location: Manchester(England)

Re: How to cut my Internet connection using DOS commands?

#2 Post by Skeletor » 02 Sep 2008 06:08

budhax wrote:1.a How to cut my Internet connection using DOS commands?
After those commands:
netsh firewall delete portopening TCP 80
netsh firewall delete allowedprogram program = "C:\Program Files\Mozilla Firefox\firefox.exe"
I was still connected to Internet!!

1.b How to reverse action 1.a using DOS command(s)?

2. Which Windows service(s) should I stop to cut my Internet connection?
Thanks


Try this batch i wrote a while ago to do exactly what you want
Run once to store and change run again to restore

@echo off
SETLOCAL
:: Set the network card static to your current Local IP if you still require local subnet access
:: Set the gateway to a non internet gateway

set connection=Local Area Connection
set static=192.168.0.2
set subnet=255.255.255.0
set gateway=192.168.255.255
set dnsip=192.168.0.1

if exist "%connection%.sav" (Call :restore&goto :eof)

call :main_start
goto :eof

:main_start
Echo Saving %connection% Network Settings...
>NUL: netsh -c interface dump > "%connection%.sav"

Echo :: Setting %connection%...
Echo :: Static :%static%
Echo :: Subnet :%subnet%
Echo :: Gateway :%gateway%
Echo :: DNS :%dnsip%
>NUL: netsh interface ip set address name="%connection%" source=static addr=%static% mask=%subnet% gateway=%gateway% 1
>NUL: netsh interface ip set dns name="%connection%" source=static addr=%dnsip%
goto :eof

:restore
Echo Restoring %connection% Network Settings...
>NUL: netsh -f "%connection%.sav"
del /q "%connection%.sav"
goto :eof

Post Reply