You could scan the file for this line (as you are doing it now) but instead of processing it directly you could store the lines below *==============
somehow (eg. in a temp file). If you find another line like *==============
you delete everything you have saved till then and start saving the lines below again. You will end up at the last line containing *==============
save everything below it and reach the end of file so only the last block will remain in the temp file. Now you can process the file and be sure that it contains only data below the last *==============
line.
The code would look something like this:
SETLOCAL EnableDelayedExpansion
for /F "tokens=*" %%A in (%file%.txt) do (
SET currentline = %%A
SET currentstring=!currentstring~0,15!
IF !currentstring!==*============== (
TYPE NUL > tempFile.txt
) ELSE (
ECHO %%A>>tempFile.txt
)
)
::process the data from tempFile.txt