I am trying to make a batch file to execute a few things for me.
Now I do understand a few programming languages, but I haven\'t done much in batch file programming yet. >
If you simply want to output the matching line with no logic checking, do
findstr /i "node" "%file1%"
If you want to execute some code if the line is found, use conditional execution.
findstr /i "node" "%file1%" && (
rem File contained "node". Do some stuff.
) || (
rem File did not contain "node". Do something else.
)
And if you want to use findstr
to test for the existence of a string without actually dumping the result to the console, simply add >NUL
either before or after the findstr
command.
>NUL findstr /i "node" "%file1%" && (success) || fail