【发布时间】:2014-09-17 17:44:18
【问题描述】:
我只想从命令的输出中打印出某一行。
让我们以ipconfig 命令为例。这会返回很多行。
Windows IP Configuration
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : ab80::456d:123e:5ae5:9ab6%15
IPv4 Address. . . . . . . . . . . : 192.168.1.33
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Ethernet adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
我只想打印第 11 行。
我尝试了以下
FOR /F "skip=10 delims=" %G IN ('IPCONFIG') DO @ECHO %G
这只会跳过前 10 行并打印其余行。
Default Gateway . . . . . . . . . : 192.168.1.1
Ethernet adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
如何只打印第 11 行?
【问题讨论】:
标签: windows batch-file cmd command-prompt