I'm new to windows batch scripts but have started using the findstr
command e.g.
findstr "test" file.txt
if not errorlevel 1 ( echo Found it!)
The code manages to findtest
in file.txt
but I don't want it to output the line where it finds "test" I just want it to echo Found it!
Is this possible with findstr
or should I be using something else?
Just redirect the output to nul
.
findstr "test" file.txt >nul
if not errorlevel 1 ( echo Found it!)