There are several ways of managing this item: SED, FINDSTR and even a FOR loop.
My favorite method is using a SED utility. SED is very flexible and SED scripts. A SED script run from your batch file will provide the functionality you require. For simple items, it could be a one line SED “script.”
From your example, removing blank lines is a simple single line SED script.
A second method is using FINDSTR or FIND (windows utilities) and “print” lines that don’t match to a file. You can run multiple FINDSTR in a brute force approach.
A third method is using a FOR loop to process each line of the file and only adding the lines you want to a new file.
Seder’s Super SED
Take a look at this similar question and answer. It was about replacing lines, but the script provided could easily be modified to remove lines.
Feel free to post any questions/doubts/comments you might have.