6,185
社区成员
发帖
与我相关
我的任务
分享
@echo off
rem 本程序将设置网卡IP地址,终于请按 ctrl+c 立即结束本程序运行。
pause
rem eth 为网卡名称,可在网络连接中查询,如"本地链接"
set eth="本地链接"
rem ip //ip 为你想更改的IP
set ip=192.168.0.213
rem gw 为网关地址
set gw=192.168.0.252
rem netmasks //netmasks 为子网掩码
set netmasks=255.255.255.0
echo 正在将本机IP更改到: %ip%
if %gw%==none netsh interface ip set address %eth% static %ip% %
netmasks% %gw% > nul
if not %gw%==none netsh interface ip set address %eth% static %ip% %
netmasks% %gw% 1 > nul
echo.........................
echo 检查当前本机IP:
ipconfig
echo.........................
echo 成功将本机IP更改为%ip%!
pause
# "本地连接" 的接口 IP 配置
set address name="本地连接" source=dhcp
set dns name="本地连接" source=dhcp register=PRIMARY
set wins name="本地连接" source=dhcp
# "本地连接" 的接口 IP 配置
set address name="本地连接" source=static addr=192.168.0.188 mask=255.255.255.0
set address name="本地连接" gateway=192.168.0.252 gwmetric=0
set dns name="本地连接" source=static addr=192.168.0.1 register=PRIMARY
set wins name="本地连接" source=static addr=none
备份:netsh -c interface dump >ip1.txt
还原:netsh -f ip1.txt