在批处理文件中逐行读取文本

时间:2013-12-13 12:15:59

标签: batch-file file-io port

我正在疯狂地试图在批处理文件中阅读此文本文件:

Binary  CapabilityDescriptions  Caption                                             Availability
TRUE                            Intel(R) Active Management Technology - SOL (COM3)  2           
TRUE                            Intel(R) Active Management Technology - SOL (COM4)  2           
TRUE                            Intel(R) Active Management Technology - SOL (COM5)  2           

如果标题包含字符串“Intel”,我试图获取COM编号。

1 个答案:

答案 0 :(得分:2)

试试这个:

@echo off
setlocal

for /f "tokens=4 delims=()" %%a in ('findstr "Intel(R)" findintel.txt') do echo %%a