You script is fine unless the file contains exclamation marks! Delayed expansion causes the problem and the only way I have found to get around this problem is toggle it on and off inside the loop.
All the other mucking around is for empty lines, then lines that start with ].
For all that it is quite slow.
for /f "delims=" %%a in ('type myfile^|find /n /v ""') do (
set str=!str: = !
call :strip in ter nal
if "%~1%~2%~3"=="internal" (
if "!str:~0,1!"=="]" (
) else (
Ditto about the tabs, with pre tags sometimes they work, as with today, and sometimes they don't, like last week.....