首页 > 其他 > 详细

自动获取ip

时间:2020-08-13 00:16:22      阅读:62      评论:0      收藏:0      [点我收藏+]

ip

@echo off

:start

echo ============请输入数字选择下一步操作:

echo ============1:ip设置为192.168.1.101

echo ============2:ip设置为192.168.1.102

echo ============3:设置为DHCP自动获取ip

set /P var=":"

if %var%==1 goto ip101

if %var%==2 goto ip102

if %var%==3 goto ipdhcp
:ip101

cls
netsh interface ip set address "本地连接" static 192.168.1.101 255.255.255.0 192.168.1.1
netsh interface ip set dns "本地连接" static 114.114.114.114 primary
netsh interface ip add dns "本地连接" 8.8.8.8
echo **IP设置为192.168.1.101,设置成功**
echo ------------------------------------------

goto start
:ip102

cls
netsh interface ip set address "本地连接" static 192.168.1.102 255.255.255.0 192.168.1.1
netsh interface ip set dns "本地连接" static 114.114.114.114 primary
netsh interface ip add dns "本地连接" 8.8.8.8
echo **IP设置为192.168.1.102,设置成功**
echo ------------------------------------------

goto start
:ipdhcp

cls

netsh interface ip set address name="本地连接" source=dhcp

netsh interface ip delete dns "本地连接" all

ipconfig /flushdns

echo **IP设置为DHCP获取,设置成功**
echo ------------------------------------------

goto start

  参考链接

自动获取ip

原文:https://www.cnblogs.com/iupoint/p/13493748.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!