To check if a string is present in a file

Dell / Optiplex gx270...
October 9, 2009 at 08:45:44
Specs: Windows XP, 2.992 GHz / 1021 MB
I need to Find the presence of a String in the first line of a file and if its available then do a set of actions else exit

See More: To check if a string is present in a file

Report •


#1
October 9, 2009 at 08:57:38
setlocal
set /p a=<file.txt
if "%a:searchstring=%" == "%a%" then (
echo searchstring NOT found in file.txt
) else (
echo searchstring FOUND in file.txt
)

Report •
Related Solutions


Ask Question