以下代码已经获取到了所有的IPV4的IP地址:- wmic nicconfig get IPAddress /value | findstr /i "IPAddress=[^]"
- pause
复制代码 执行结果如下:- C:\Users\Administrator\Desktop>wmic nicconfig get IPAddress /value | findstr /i "IPAddress=[^]"
- IPAddress={"192.168.1.2","fe80::7146:d78a:87be:2fae"}
- IPAddress={"10.0.132.181","fe80::6dee:c2a2:649d:96df"}
复制代码 能不能将192.168.1.2和10.0.132.181提取出来,并显示为两行,如下所示:- -------------------------------------------------
- | 本机局域网IP地址 | 192.168.1.2 |
- -------------------------------------------------
- | 本机以太网IP地址 | 10.0.132.181 |
- -------------------------------------------------
复制代码
|