Batch file 如何从文本文件中找到相同的特定单词并将其作为输出输出?

Batch file 如何从文本文件中找到相同的特定单词并将其作为输出输出?,batch-file,cmd,Batch File,Cmd,我有一个名为file.txt的文本文件,其中包含 A: - No such Root Directory B: - No such Root Directory C: - Fixed Drive D: - Fixed Drive E: - Removable Drive F: - CD-ROM Drive G: - Removable Drive H: - No such Root Directory I: - No such Root Directory J: - No such Root D

我有一个名为
file.txt
的文本文件,其中包含

A: - No such Root Directory
B: - No such Root Directory
C: - Fixed Drive
D: - Fixed Drive
E: - Removable Drive
F: - CD-ROM Drive
G: - Removable Drive
H: - No such Root Directory
I: - No such Root Directory
J: - No such Root Directory
K: - No such Root Directory
M: - No such Root Directory
N: - No such Root Directory
O: - No such Root Directory
P: - No such Root Directory
Q: - No such Root Directory
R: - No such Root Directory
S: - No such Root Directory
T: - No such Root Directory
U: - No such Root Directory
V: - No such Root Directory
W: - No such Root Directory
X: - No such Root Directory
Y: - No such Root Directory
Z: - No such Root Directory
在这个文件中,您可以注意到单词
Removable
在第5行和第7行中出现了两次

如果它有相同的特定单词
可移动
两次或三次,则需要显示多次找到的输出单词
可移动

如果它没有相同的特定单词
可移动
两次或三次,则需要显示输出has
,没有找到多个可移动单词

对于这个输出,我运行了以下程序

findstr /b Removable "file.txt" do ( 
echo Removable word found multiple times 
) || ( 
echo There is no multiple Removable word found 
)
pause

我知道这是不对的。但是,我尽力了。朋友们,请纠正我。这将对我非常有帮助。

您应该能够使用
查找/I/C“Removable”您应该能够使用
查找/I/C“Removable”