批处理 自动修改 IP 地址
2013-08-28 15:12
507 查看
公司网络和家里网络不一样,每天回家要改一次IP,来公司要改一次IP ,很是麻烦,故整理了小批处理命令,自动来修改IP。
将以下内容保存到为bat格式就可以了。
@echo off
echo.
echo 修改ip地址,1为自动获取ip地址,2为修改家里ip地址,3 为公司IP
echo.set sel=
set/p sel=请选择修改方式:
if "%sel%"=="1" goto auto
if "%sel%"=="2" goto home
if "%sel%"=="3" goto company
echo 您没有选择修改方式。
goto end
:auto
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip delete dns "本地连接" all
ipconfig /flushdns
ipconfig /all
goto end
:home
echo 正在更改IP地址,请稍等......
netsh interface ip set address name="本地连接" source=static addr=192.168.1.80 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=202.102.192.68
netsh interface ip add dns name="本地连接" addr=202.102.199.68 index=2
ipconfig /flushdns
ipconfig /all
echo 更改IP地址完成!
goto end
:company
echo 正在更改IP地址,请稍等......
netsh interface ip set address name="本地连接" source=static addr=10.85.10.80 mask=255.255.255.0 gateway=10.85.10.253 gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=218.104.78.2
netsh interface ip add dns name="本地连接" addr=10.85.7.100 index=2
ipconfig /flushdns
ipconfig /all
goto end
:end
pause
将以下内容保存到为bat格式就可以了。
@echo off
echo.
echo 修改ip地址,1为自动获取ip地址,2为修改家里ip地址,3 为公司IP
echo.set sel=
set/p sel=请选择修改方式:
if "%sel%"=="1" goto auto
if "%sel%"=="2" goto home
if "%sel%"=="3" goto company
echo 您没有选择修改方式。
goto end
:auto
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip delete dns "本地连接" all
ipconfig /flushdns
ipconfig /all
goto end
:home
echo 正在更改IP地址,请稍等......
netsh interface ip set address name="本地连接" source=static addr=192.168.1.80 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=202.102.192.68
netsh interface ip add dns name="本地连接" addr=202.102.199.68 index=2
ipconfig /flushdns
ipconfig /all
echo 更改IP地址完成!
goto end
:company
echo 正在更改IP地址,请稍等......
netsh interface ip set address name="本地连接" source=static addr=10.85.10.80 mask=255.255.255.0 gateway=10.85.10.253 gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=218.104.78.2
netsh interface ip add dns name="本地连接" addr=10.85.7.100 index=2
ipconfig /flushdns
ipconfig /all
goto end
:end
pause
相关文章推荐
- 批处理 自动修改 IP 地址
- 自动修改电脑IP地址.bat
- 批处理 自动修改 IP 地址
- 批处理自动修改 IP 地址
- 用于验证码图片识别的类(C#源码) 使用进程投票,可自动清除Alert弹出窗口,可自动换IP,ADSL用户自行修改Restart.bat中第三行内容
- Shell脚本实现自动修改IP、主机名等功能分享
- c# 自动修改计算机名、Ip、网关
- Oracle服务器修改IP或机器名后服务无法连接的处理
- 在linux下 获取,修改本机IP地址的两个函数
- VMware ESX常用命令 和 IP 地址修改
- 在ROS的PPPOE IP变的时候自动修改DNS记录,实现DDNS
- VMware ESX常用命令 和 IP 地址修改
- VMware ESX常用命令 和 IP 地址修改
- Oracle RAC 修改 IP 地址
- 自动修改IP地址及网卡地址(批处理文件实现)
- 怎么修改路由器地址的默认IP
- windows自动修改ip的bat文件
- mybatis generator逆向工程自动生成带中文注释修改版(添加了实体类注释)文末附有git下载地址
- 自动修改IP的脚本
- Window配置网络设定IPv4的固定IP自动被修改为169.254.*.*的问题