I am looking for a batch file to search through a txt file and if it finds the word "Failed" then EXIT 1. Any help??
+1
A:
This might get you started...
type file.txt | find "Failed"
If that returns anything, you set the ERRORLEVEL variable to 1.
Hope that helps dude!
Garrett
2009-05-13 19:14:45
A:
FindStr "Failed" YourFile.Txt >Nul:
If ErrorLevel 1
... then it is NOT found (findstr returns 0 if found
Stu
2009-05-13 19:20:31
+3
A:
here is something similar to what Garrett said, but you can run it as a background process while for instance displaying some other info on stdout:
@echo off
@start /wait FIND /C /I "SearchPhrase" path-to-your-file\filename.abc
IF ERRORLEVEL 1 (do-something)
Vuk
2009-05-13 19:22:26