Note the following when the English version of the default network use, while connected to the network cable and WiFi, local networks priority WiFi.
So disabling the local network will automatically connect to WiFi, enabling the local network and disabling WiFi.
The batch supports the-slice parameter with the following code:
Switchethernet.bat
1 @echo off2pushd "%~dp0"3 SetName= "Ethernet"4 Setfindtext= "Administrative state:enabled"5 6"%systemroot%\system32\cacls.exe" "%SystemRoot%\System32\Config\SYSTEM" >nul 2>nul7 if%ERRORLEVEL%==0Goto : START8 9 Echo* * please UseAdministrator account toRun. **Ten Goto : END One A : START - Setinput= - SetSlice=0 the if"%1" = = "-slice"SetSlice=1 -netsh interface show interface name=%name% -netsh interface show interface name=%name% |Find%findtext% >nul - if ERRORLEVEL1Goto : op_enabled + : op_disabled - Echo. + if%slice% equ 1Goto : Op_d_skip A Set/P input=input ' Y ' to DISABLE interface%name% [y/N]: at Goto : Op_d_run - : Op_d_skip - EchoInput ' Y ' to DISABLE interface%name% [y/n]: Y - Setinput=Y - : Op_d_run - if/I "%input%" = = "Y" netsh interfaceSetInterface Name=%name% admin=DISABLED in Goto : END - : op_enabled to Echo. + if%slice% equ 1Goto : Op_e_skip - Set/P input=input ' Y ' to ENABLED interface%name% [y/N]: the Goto : Op_e_run * : Op_e_skip $ EchoInput ' Y ' to ENABLED interface%name% [y/n]: YPanax Notoginseng Setinput=Y - : Op_e_run the if/I "%input%" = = "Y" netsh interfaceSetInterface Name=%name% admin=ENABLED + Goto : END A : END the Echo. + EchoCurrent Status: - netsh interface show interface $ if%slice% equ 1Goto : Skip_any_key $ EchoPress any key toExit... - Pause>nul - Goto : End1 the : Skip_any_key - EchoWouldExitIn 5 seconds ...WuyiPing 127.1-n 6 >nul the : End1 -popd
Enable/Disable batch processing of Ethernet for one NIC switch on-premises network and WiFi usage (WIN10)