S
sali
i have strange behaviour inside batch file:
this works as expected:
---one line, if wrapped ---
for /f "usebackq tokens=1,2 delims=:" %%i in (`find "green" /i /c *.txt`)
do @echo %%i [%%j]
-----
the purpose is to count the number of matches of searched string, and put it
into %%j
since find /c gives result lines like this:
---------- filename.ext: number_of_match
the idea is to tokenise result line with : delimiter, and to take number
after
but this example bellow doesn't work as expected
---one line, if wrapped ---
for /f "usebackq tokens=1,2 delims=:" %%i in (`find "green" /i /c *.txt`)
do call :loop %%i %%j
-----
problem is that in second example, delims=: doesn't take effect, and for /f
command uses only default [blank] delimiter
is it expectable, am i wrong somewhere?
thnx
this works as expected:
---one line, if wrapped ---
for /f "usebackq tokens=1,2 delims=:" %%i in (`find "green" /i /c *.txt`)
do @echo %%i [%%j]
-----
the purpose is to count the number of matches of searched string, and put it
into %%j
since find /c gives result lines like this:
---------- filename.ext: number_of_match
the idea is to tokenise result line with : delimiter, and to take number
after
but this example bellow doesn't work as expected
---one line, if wrapped ---
for /f "usebackq tokens=1,2 delims=:" %%i in (`find "green" /i /c *.txt`)
do call :loop %%i %%j
-----
problem is that in second example, delims=: doesn't take effect, and for /f
command uses only default [blank] delimiter
is it expectable, am i wrong somewhere?
thnx