:jz1 cls echo 您目前有的配置有: & type 1.txt echo. set j= set /p j=是否要加载现有的IP配置?(Y/N): if /I "%j%"=="N" goto oderip set jname= set /p jname=请出入你要加载的IP配置的名字: echo. echo. echo 要加载的配置是:%jname% if exist N.txt del N.txt find "%jname% 连接名字" %windir%\xixi.ini >N.txt for /f "skip=2 tokens=3" %%N in (N.txt) do set name=%%N echo 连接名字:%name% if exist I.txt del I.txt find "%jname% IP地址" %windir%\xixi.ini >I.txt for /f "skip=2 tokens=3" %%I in (I.txt) do set ip=%%I echo IP地址:%ip% if exist Z.txt del Z.txt find "%jname% 子网掩码" %windir%\xixi.ini >Z.txt for /f "skip=2 tokens=3" %%Z in (Z.txt) do set mask=%%Z echo 子网掩码:%mask% if exist M.txt del M.txt find "%jname% 默认网关" %windir%\xixi.ini >M.txt for /f "skip=2 tokens=3" %%M in (M.txt) do set gateway=%%M echo 默认网关:%gateway% if exist S.txt del S.txt find "%jname% 首选DNS" %windir%\xixi.ini >S.txt for /f "skip=2 tokens=3" %%S in (S.txt) do set dns1=%%S echo 首选DNS:%dns1% if exist B.txt del B.txt find "%jname% 备用DNS" %windir%\xixi.ini >B.txt for /f "skip=2 tokens=3" %%B in (B.txt) do set dns2=%%B echo 备用DNS:%dns2% del /f /q 1.txt del /f /q N.TXT del /f /q I.TXT del /f /q Z.TXT del /f /q M.TXT del /f /q S.TXT del /f /q B.TXT echo. echo. set c= set /p c=加载完成!现在要开始设置?(Y/N): if /I "%c%"=="n" goto oderip goto set :lr cls set pname= set /p pname=请输入连接名(如:家里的IP配置): set name= set /p name=请输入连接名(如:本地连接): set ip= set /p ip=请输入IP地址(如:192.168.0.2): set mask= set /p mask=请输入子网掩码(如:255.255.255.0): set gateway= set /p gateway=请输入网关(如:192.168.0.1): set dns1= set /p dns1=请输入首选DNS(如:61.128.128.68): set dns2= set /p dns2=请输入备用DNS(如:202.202.145.5): echo. echo. echo 需要保存这个配置吗?如果保存下次使用可以直接加载这个配置无需手动输入。 set s= set /p s=(Y/N): if /I "%s%"=="Y" goto save :set cls netsh interface ip set address name="%name%" source=static addr=%ip% mask=%mask% echo IP和子网掩码设置完成........ netsh interface ip set address name="%name%" gateway=%gateway% gwmetric=0 echo 网关设置完成........ netsh interface ip set dns name="%name%" source=static addr=%dns1% register=PRIMARY echo DNS1设置完成........ netsh interface ip add dns name="%name%" addr=%dns2% echo DNS2设置完成........ netsh interface ip set wins name="%name%" source=static addr=none goto oderip :save cls echo 配置: %pname% >>%windir%\xixi.ini echo %pname% 连接名字: %name% >>%windir%\xixi.ini echo %pname% IP地址: %ip% >>%windir%\xixi.ini echo %pname% 子网掩码: %mask% >>%windir%\xixi.ini echo %pname% 默认网关: %gateway% >>%windir%\xixi.ini echo %pname% 首选DNS: %dns1% >>%windir%\xixi.ini echo %pname% 备用DNS: %dns2% >>%windir%\xixi.ini echo. >>%windir%\xixi.ini echo 储存成功…… ping -n 3 127.1>nul set s= set /p s=需要用这套配置设置吗?(Y/N): if /I "%s%"=="Y" goto set goto oderip :delset cls del /f /q %windir%\xixi.ini echo 删除完成…… ping -n 5 127.1>nul goto oderip 因编辑器导致代码变形,特打包提供下载ip_auto_suoding_jb51.rar |