如何停止在批处理文件中显示任何消息的findstr?

时间:2014-09-04 15:21:04

标签: batch-file

我想停止findstr显示任何消息,我能够这样做但我还想将findstr结果作为文本文件提取,如果我停止findstr来显示消息如下:

FINDSTR: can't open anything.exeFINDSTR: Line 185369536 is too long

使用findstr /s /m "anything" "C:\*.*">nul 2>&1

然后,我无法将findstr结果显示为文本文件。

findstr作为文本文件提取而不显示任何findstr条消息的代码是什么?

1 个答案:

答案 0 :(得分:0)

findstr ..... >"myFile" 2>nul 

将stdout流重定向到文件,将stderr流重定向到nul。这样就可以在隐藏错误的同时保存有效数据