I have found this example here:
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ("GEN 0 GENERAL.html") do (
echo do my commands on %%a
pause
)
pause
I should read file line by line. My goal is to read and print whole line, not just one or two tokens. For me this does not work. Any idea why?
I got this output:
do my commands on GEN 0 GENERAL.html
Press any key to continue…
Solved:
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= usebackq" %%a in ("GEN 0 GENERAL.html") do (
echo do my commands on %%a
pause
)
pause
Add
usebackqto your options list, after thetokensanddelimsoptions:As you have it written, the double quotes around the filename are causing it to be interpreted as a string (and not the name of file containing strings).