- @echo off
- for /f "delims=: tokens=2" %%a in ('ipconfig /all^|FIND /i "IPv4 地址"') do set IP=%%a
- for /f "delims=: tokens=2" %%i in ('ipconfig /all^find /i "默认网关"') do set gw=%%i
- for /f "delims=: tokens=2" %%n in ('ipconfig /all^find /i "子网掩码"') do set mask=%%n
- for /f "delims=: tokens=2" %%k in ('ipconfig /all^find /i "DNS 服务器"') do set Dns1=%%k
- netsh interface ip set address "无线网络连接" source=static addr=%IP% mask=%mask% gateway=%gw% gwmetric=1
- netsh interface ip set dns "无线网络连接" static %Dns1%
- pause
复制代码 这个为什么不好用?本人新手求大神解答 |