It seems for me a very simple question, however I am struggling a lot with this and don't find an answer yet. My aim is to count occurences of a specific string in a file. I do or try to do this using following command:
for /f "tokens=2 delims=;" %%a in ('path to file with searchstring') do (
set count=('path to file I am searching in' find /c "%%a")
if !count! NEQ 0 echo !count!
)
Seems straightforward for me however the second line seems to be wrong as the script exits.
I want to save the result of find
in a var because I only wants to outpout Nonzero resutls.