Because I used to work in a government unit, the government internal network needed to plug in a network cable, and to access the external network, I needed to connect to wifi. To switch, I had to unplug the network cable and plug it in, which was very troublesome. The brother next to me taught me how to automatically switch the .bat program. The bat file code is as follows:
After the .bat file of the following code is executed, it will switch to Ethernet and turn off wifi and Ethernet 4 at the same time.
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
taskkill /f /im VRC_ClientGUI.exe
taskkill /f /im VRC_Pluto.exe
netsh interface set interface "以太网 4" disabled
netsh interface set interface "WLAN" disabled
netsh interface set interface "以太网" enabled
exit
After the .bat file of the following code is executed, it will switch to wifi and turn off Ethernet at the same time.
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
:begin
taskkill /f /im VRC_ClientGUI.exe
taskkill /f /im VRC_Pluto.exe
netsh interface set interface "以太网 4" enabled
netsh interface set interface "WLAN" enabled
netsh interface set interface "以太网" disabled
exit