批处理-ip地址显示

时间:2026-02-12 04:55:28

1、命令提示符窗口查看ip地址信息ipconfig,如果添加虚拟机等网卡显示比较多不方便查看如下。

批处理-ip地址显示

2、使用可以使用find参数,筛选其中ipv4地址如下。

批处理-ip地址显示

3、直接写入批处理文件中发现有出错这里用for语法,for /f "delims=: tokens=1" %%i in ('ipconfig ^| find /i "以太网" ') do echo %%i  以:为分隔符取第一块的数据。

批处理-ip地址显示

4、for /f "delims=: tokens=2" %%j in ('ipconfig ^| find /i "IPv4" ') do echo %%j还是以:为分隔符,截取第二块的数据如下。

批处理-ip地址显示

5、所有代码网卡的名称与ip地址一一对应,代码运行结果如下。

批处理-ip地址显示

批处理-ip地址显示

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com