我必须在文本文件中搜索字符串“Failed”,并希望“find”命令失败或者如果找到字符串则返回失败。
答案 0 :(得分:1)
findstr /c:"Failed" filename.txt && Echo Failed found || Echo Failed not found
或
findstr /c:"Failed" filename.txt
If Errorlevel 1 echo Failed not found or file couldn't be read
请参阅findstr /?
和if /?
。
Findstr 0 = found,1 = not found,2 = file not not read。