UNIXETC

通过批处理控制网卡接口

将内网网卡名改为"lan",将外网网卡名改为"wlan"

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
REM copyright unixetc.com

@echo off
set /p input=a:内网/b:外网/c:禁用/d:开启

if "%input%"=="a" goto MA
if "%input%"=="b" goto MB
if "%input%"=="c" goto MC
if "%input%"=="d" goto MD
if not "%input%"== "a" (if not "%input%"=="b"(if not "%input%"=="c" (if not "%input%"=="d" goto ME)))

:MA
echo 单开内网
netsh interface set interface "lan" enabled
netsh interface set interface "wlan" disabled
ping 133.64.8.1 -n 10
echo 设置完成!
pause>nul
exit

:MB
echo 单开外网
netsh interface set interface "lan" disabled
netsh interface set interface "wlan" enabled
ping baidu.com -n 10
echo 设置完成!
pause>nul
exit

:MC
echo 禁用网络
netsh interface set interface "lan" disabled
netsh interface set interface "wlan" disabled
echo 设置完成!
pause>nul
exit

:MD 
echo 开启网络
netsh interface set interface "lan" enabled
netsh interface set interface "wlan" enabled
echo 设置完成!
pause>nul
exit

:ME
echo 啥都没干,退下!
pause>nul
exit