
CODE: [Copy to clipboard]Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\WINDOWS>ipconfig
Windows IP Configuration
Ethernet adapter 无线网络 Intel:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.0.12
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . : 192.168.0.1
Ethernet adapter 本地连接:
Media State . . . . . . . . . . . : Media disconnected
CODE: [Copy to clipboard]在命令行中输入应该就可以看到PPP拨号的IP了。wmic nicconfig where Description="WAN (PPP/SLIP) Interface" get ipaddress
CODE: [Copy to clipboard]一般来说,netsh显示IP会把PPP拨号的IP显示在前,所以show ip 1应该能够实现目的,同样的,如果用show ip 2则会显示网卡的IP。(若有哪位的IP排列和我的相反请吱一声,我这没条件测试。)netsh diag show ip 1
CODE: [Copy to clipboard]和netsh相反,ipconfig在显示IP的时候会把网卡IP显示在前面,所以只要获得后面的IP就可以得到我们需要的IP。@echo off
for /f "tokens=2 delims=:" %%i in ('ipconfig ^|findstr /i "ip address"') do set ip=%%i
echo %ip%
pause
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |