1.win10 wlan和WiFi切换的批处理文件?
以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI/*&cls@echo offrem 自动切换有线和无线网络连接set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4title %#% +%$%%$%/%@% %z%wmic NIC where "PhysicalAdapter=True and PNPDeviceID like 'PCI\\%%'" get NetConnectionID,MACAddress>"%tmp%\t.t"set n=0&set m=0&set "flag="for /f "skip=1 delims=" %%a in ('type "%tmp%\t.t"^|cscript -nologo -e:jscript "%~f0"') do ( set /a "n+=1,m+=1" for /f "tokens=1*" %%b in ("%%a") do ( call set "_#m%%m%%=%%b" call set "_#n%%n%%=%%c" ))if "%n%" neq "2" (echo;仅适用双网卡&goto end)if "%_#m1%" neq "#" (if "%_#m2%" neq "#" (set flag=disabled))if "%_#m1%" equ "#" (if "%_#m2%" equ "#" (set flag=enabled))if not defined flag (goto check)if /i "%flag%" equ "disabled" ( echo;首次设置,先选择一个需禁用的网络连接) else ( echo;首次设置,先选择一个需启用的网络连接)echo;1、%_#n1%echo;2、%_#n2%set /p input=输入数字序号并按回车键:echo;"%input%"|>nul findstr /be "\"[12]\""||(echo;输入有误&goto end)setlocal /f "delims=" %%a in ("!_#n%input%!") do ( netsh interface set interface "%%a" %flag%)endlocalgoto end:checkif "%_#m1%" equ "#" ( echo;[禁用--^>启用] "%_#n1%" netsh interface set interface "%_#n1%" enabled echo;[启用--^>禁用] "%_#n2%" netsh interface set interface "%_#n2%" disabled) else ( echo;[启用--^>禁用] "%_#n1%" netsh interface set interface "%_#n1%" disabled echo;[禁用--^>启用] "%_#n2%" netsh interface set interface "%_#n2%" enabled):endecho;%#% +%$%%$%/%@% %z%pauseexit*/while(!WSH.StdIn.AtEndOfStream){ var line=WSH.StdIn.ReadLine().replace(/\s*$/g,''); if(line !=''){WSH.echo('#'+line);}}WSH.Quit();。
转载请注明出处windows之家 » win10设置路由批处理