6

How can I easily disable (and later re-enable) internet access on Windows 7 via the command line (for an anti-procrastination script)? It would work fine if rebooting re-enables internet access. No local network access is required.

1
  • If it's anti-procrastination you're concerned with, then can I suggest physically unplugging the network cable and/or switching off the WIFI adapter. This works especially well if you have to get up from your chair to plug it back in....
    – DAB
    Oct 17, 2017 at 8:17

4 Answers 4

4

You can also, disable the internet connection just by releasing the assigned IP address.

From the elevated command prompt (Run as administrator), type:

ipconfig/release

When you want to enable the internet connection then:

ipconfig/renew

Hope this helps

4

Try netsh:

netsh interface set interface "Local Area Connection " ENABLE
netsh interface set interface "Local Area Connection " DISABLE
1
  • This did not work for me on Windows 8.1, though ipconfig \release did. Tried different combinations of the name, Run as Administrator, and so on. Nothing appeared to work. Recommend answer from @vernbutech.
    – AlainD
    Jul 6, 2017 at 21:23
0
route delete -p 0.0.0.0

{shutdown}

route add -p 0.0.0.0 MASK 0.0.0.0 <gataway ISP1> METRIC <METRIC 1> IF <interface number ISP1>
route add -p 0.0.0.0 MASK 0.0.0.0 <gataway ISP2> METRIC <METRIC 2> IF <interface number ISP2>
0

For me (win 7) these commands only work if I deleted the space before the second ".

netsh interface set interface "Local Area Connection" ENABLE
netsh interface set interface "Local Area Connection" DISABLE

I'm wondering if there is a command that can cut off all external connections but leave the wan and lan OK.

1
  • 1
    Huh? a WAN is the external connections.
    – DavidPostill
    Jan 2, 2017 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .