5
3
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.
5
3
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.
3
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
3
Try netsh:
netsh interface set interface "Local Area Connection " ENABLE
netsh interface set interface "Local Area Connection " DISABLE
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 – 2017-07-06T21:23:09.180
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.
1Huh? a WAN is the external connections. – DavidPostill – 2017-01-02T17:19:55.633
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>
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 – 2017-10-17T08:17:27.713