自动修改ip地址 批处理
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
set /p choice= 您的选择: echo. if "%choice%"=="1" goto ip1 if "%choice%"=="2" goto ip2 if "%choice%"=="3" goto end if "%choice%"=="4" goto test goto main :ip1 echo IP自动设置开始.... echo. echo 正在设置IP及子网掩码 cmd /c netsh interface ip set address name="本地连接" source=static addr=192.168.1.1 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1 echo 正在设置DNS服务器 cmd /c netsh interface ip set dns name="本地连接" source=static addr=61.234.254.5 register=PRIMARY echo 正在设置DNS服务器 cmd /c netsh interface ip add dns name="本地连接" addr=59.54.78.210 echo 设置完成 pause exit if errorlevel 2 goto main if errorlevel 1 goto end :ip2 echo IP自动设置开始.... echo. echo 自动获取IP地址.... netsh interface ip set address name = "本地连接" source = dhcp echo 自动获取DNS服务器.... netsh interface ip set dns name = "本地连接" source = dhcp @rem 设置自动获取IP echo 设置完成 pause exit if errorlevel 2 goto main if errorlevel 1 goto end :test netsh inte***ce ip set address name = "本地连接" source = dhcp netsh inte***ce ip set dns name = "本地连接" source = dhcp netsh inte***ce ip set wins name = "本地连接" source = dhcp CHOICE /C YN /M "退出请按 Y,返回菜单请按 N。" if errorlevel 2 goto main if errorlevel 1 goto end :end |