Skip to content

Instantly share code, notes, and snippets.

@longtth
Last active February 10, 2018 08:35
Show Gist options
  • Save longtth/6db084611ef40390ff58b8698145b207 to your computer and use it in GitHub Desktop.
Save longtth/6db084611ef40390ff58b8698145b207 to your computer and use it in GitHub Desktop.
NETSH interface set interface name="Ethernet" admin=ENABLE
NETSH interface set interface name="Wi-Fi" admin=DISABLED
REG add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
NETSH interface set interface name="Wi-Fi" admin=ENABLE
NETSH interface set interface name="Ethernet" admin=DISABLED
REG add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
REM if you want to use another proxy server:
REM reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^
REM /v ProxyServer /t REG_SZ /d proxyserveraddress:proxyport /f
REM check if Wifi is enabled then disable wifi, enable ethernet,
REM else enable wifi, disable ethernet.
REM there is a command for get current status but how to check using code? [netsh interface show interface]
REM C:\Users\longnx>netsh interface show interface
REM
REM Admin State State Type Interface Name
REM -------------------------------------------------------------------------
REM Disabled Disconnected Dedicated VirtualBox Host-Only Network
REM Enabled Connected Dedicated Local Area Connection* 13
REM Enabled Connected Dedicated Wi-Fi
REM Disabled Disconnected Dedicated Ethernet
REM
REM
REM C:\Users\longnx>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment