I have to search a text file for the string "Failed" and want the 'find' command should fail or return fail if it finds the string.
1
-
Please edit with more detail to clarify your question. – Mogsdad Mar 18 '16 at 2:19
Add a comment
|
findstr /c:"Failed" filename.txt && Echo Failed found || Echo Failed not found
or
findstr /c:"Failed" filename.txt
If Errorlevel 1 echo Failed not found or file couldn't be read
See findstr /?
and if /?
.
Findstr 0 = found, 1 = not found, and 2 = file couldn't be read.