需要切换不同IP的朋友过来看看这个简单的CMD脚本。
直接上代码,复制保存BAT文件就可以用了。
@echo off
echo 输入 1 自动获取 IP
echo 输入 2 切换手动 IP

set /P var="input number(exit other):"
if %var%==1 (
netsh interface ip set address name="网络名字" source=dhcp
netsh interface ip set dns name="网络名字" source=dhcp
echo IP已设置为自动获取
)
if %var%==2 (
netsh interface ip set address name="网络名字" static 192.168.0.3 255.255.255.0 192.168.0.252
netsh interface ip set dns "网络名字" static 192.168.0.252 primary
netsh interface ip add dns "网络名字" static 192.168.0.252
echo IP已设置为固定IP地址(new)
)

)

pause

我的世界

作者 isdiy.net

爱来DIY 收集资料,兴趣收集。isdiy.net

发表评论