Skip to content

Instantly share code, notes, and snippets.

@benwu232
Created August 22, 2014 08:07
Show Gist options
  • Save benwu232/a8a6cdcbabd741c3fbde to your computer and use it in GitHub Desktop.
Save benwu232/a8a6cdcbabd741c3fbde to your computer and use it in GitHub Desktop.
Switch between WiFi and LAN in windows.
@Echo off
Echo Switch between LAN and WiFi
net start dot3svc
netsh wlan show interfaces >NUL
choice /C 12 /M "1: WiFi; 2: LAN"
if errorlevel 2 goto LAN
if errorlevel 1 goto WLAN
:LAN
Echo Turn on LAN and turn off WiFi
netsh interface set interface "Wi-Fi" Disable
sc start dot3svc >NUL
netsh interface set interface "Ethernet" Enable
goto end
:WLAN
Echo Turn on WiFi and turn off LAN
sc start dot3svc >NUL
netsh interface set interface "Wi-Fi" Enable
sc stop dot3svc >NUL
netsh interface set interface "Ethernet" Disable
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment