- :::此代码在XP下能正确读取首选DNS,但在win7不能
- for /f "tokens=2 delims=:" %%i in ('ipconfig /all ^|findstr /i "DNS"') do set dns=%%i echo 首选DNS:%dns%
复制代码
- :::此代码在XP和win7下都能正确读取备用DNS
- for /F "tokens=1,2* delims=:. " %%a in ('ipconfig/all') do (if defined s set s=%%a.%%b.%%c &goto:hanye)&if /i "%%a%%b"=="DNSServers" set s=no
- :hanye
- echo 备用DNS=%s%
复制代码 请教高手,在XP和win7下都能正确读取首选DNS的代码该如任编写???
[ 本帖最后由 keshun 于 2010-10-30 12:56 编辑 ] |