动态获取IP,ipconfig/all得到的文本如下:
Windows IP Configuration
Host Name . . . . . . . . . . . . : mingtian
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8139/810X Family PCI Fast Ethernet NIC
Physical Address. . . . . . . . . : 00-60-4f-00-B8-BB
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.0.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 218.147.135.14
218.146.10.110
192.168.0.1
Lease Obtained. . . . . . . . . . : 2010年4月15日 20:25:15
Lease Expires . . . . . . . . . . : 2010年4月16日 20:25:15
怎样获得以上文本中的备用DNS地址,也就是218.146.10.110这段.
我用这句得到的不正确,还望高手指点.
for /f "skip=21 tokens=1 delims= " %%i in ('ipconfig/all') do set dns2=%%i&echo %%i
[ Last edited by antony521 on 2010-4-18 at 11:04 ]
Windows IP Configuration
Host Name . . . . . . . . . . . . : mingtian
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8139/810X Family PCI Fast Ethernet NIC
Physical Address. . . . . . . . . : 00-60-4f-00-B8-BB
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 192.168.0.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 218.147.135.14
218.146.10.110
192.168.0.1
Lease Obtained. . . . . . . . . . : 2010年4月15日 20:25:15
Lease Expires . . . . . . . . . . : 2010年4月16日 20:25:15
怎样获得以上文本中的备用DNS地址,也就是218.146.10.110这段.
我用这句得到的不正确,还望高手指点.
for /f "skip=21 tokens=1 delims= " %%i in ('ipconfig/all') do set dns2=%%i&echo %%i
[ Last edited by antony521 on 2010-4-18 at 11:04 ]
