The following loop/function is supposed to edit a file (just replacing the second line in the file). The original file contains one > 165000 signs long line and just this line is simply disappearing in the new file after performing this loop.
setlocal EnableDelayedExpansion
set /a count=0
>"%~3" (
for /f "usebackq delims=" %%A in ("%~2") do (
if !count!==1 (echo ^<html^>) else (
setlocal DisableDelayedExpansion
echo.%%A
endlocal)
set /a count+=1
)
)
endlocal
goto:eof
I assume that it has to do with the maximum length a variable (%%A) can store.. is there a way to avoid this behavior?
Thanks in advance!