新建txt文件,然后把后缀改成 xx.bat ,然后用记事本打开,里面的内容用复制下面的内容,根据实际情况调整不用情况的ip配置,双击运行用,输入1时则根据1对应的配置自动设置ip
@echo off
:start
echo ============请输入数字选择下一步操作:
echo ============1:ip设置为10.25.1.89
echo ============2:ip设置为192.168.35.111
echo ============3:设置为DHCP自动获取ip
set /P var=":"
if %var%==1 goto ip10
if %var%==2 goto ip172
if %var%==3 goto ipdhcp
:ip10
cls
netsh interface ip set address name="本地连接" source=static
addr=10.25.1.89 mask=255.255.255.0 gateway=10.25.1.254
cmd /c netsh interface ip set dns "本地连接" source=static
addr=192.168.254.13
echo **IP设置为10.25.1.89,设置成功**
echo ------------------------------------------
goto start
:ip192
cls
netsh interface ip set address name="本地连接" source=static
addr=192.168.35.111 mask=255.255.255.0 gateway=192.168.35.254
cmd /c netsh interface ip set dns "本地连接" source=static
addr=192.168.254.8
echo **IP设置为192.168.35.101,设置成功**
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