快速切换与自定义IP地址

前端之家收集整理的这篇文章主要介绍了快速切换与自定义IP地址前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是编程之家 jb51.cc 通过网络收集整理的代码片段。

编程之家小编现在分享给大家,也给大家做个参考。

@echo off
:0
echo.---------------------------------------------
echo.输入1设置自动获取IP地址
echo.输入2设置为192.168.1.251
echo.输入3设置为192.168.2.251

echo.输入4为自动获取DNS
echo.输入5为修改DNS设置到谷歌IP=8.8.8.8
echo.输入6为修改DNS设置到四川电信IP=61.139.2.69
echo.输入7为手动设置IP
echo.输入8为手动设置DNS
echo.输入9结束操作
echo.---------------------------------------------
set /p id=请输入相应数字:

if %id%==1 goto :1
if %id%==2 goto :2
if %id%==3 goto :3
if %id%==4 goto :4
if %id%==5 goto :5
if %id%==6 goto :6
if %id%==7 goto :7
if %id%==8 goto :8
if %id%==9 goto :9

:1
netsh interface ip set address name="本地连接" source=DHCP
goto :0
exit

:2
netsh interface ip set address name="本地连接" source=static addr=192.168.1.251 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1
goto :0

:3
netsh interface ip set address name="本地连接" source=static addr=192.168.2.251 mask=255.255.255.0 gateway=192.168.2.1 gwmetric=1
goto :0

:4
netsh interface ip set dns name="本地连接" source=DHCP
goto :0

:5
netsh interface ip set dns name="本地连接" source=static addr=8.8.8.8
goto :0
:6
netsh interface ip set dns name="本地连接" source=static addr=61.139.2.69
goto :0

:7
set /p addr=address:
set /p mask=mask:
set /p gate=geteway:
netsh interface ip set address name="本地连接" source=static addr=%addr% mask=%mask% gateway=%gate% gwmetric=1
goto :0
:8
SET /P dns=DNS:
netsh interface ip set dns name="本地连接" source=static addr=%dns%
goto :0
:9
exit

以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

猜你在找的Shell相关文章