There is an art to writing batch code, scripts and programs. There is also the mechanics of doing the same. One thing for sure is not to write the entire set of code before testing starts. Batch code is especially notorious for issuing cryptic messages with no clue as to where the error occurred. Code should be written is segments so you can test as you go. You may not have all the bells and whistles of the final product, but you won't have start debugging from line 1 either.
A couple of things I found:
You use
goto eof (this is an error should be
goto :eof)
You also use
goto end; no error just curious why, in this script they accomplish the same thing.
I could not use
ctl-C to escape from the prompts.
The input file ends up with zero bytes. Your users may not like having their original file destroyed.
The code in the
:AddText label turned up no errors, so look for a logic error or even whether the code is executed at all.
Check out this
thread. Both the Microsoft XML parser method within a VBScript and the brute force method of the file system object are shown. Personally I prefer the parser as XML files have a rigid structure and the parser can easily traverse the nodes.
If you insist on using batch code, turn
echo on so you can see what values the variable take on as the script runs. You may have to insert a few well placed
pause statements to stop the scrolling.
Good luck.
![Cool 8)](https://www.computerhope.com/forum/Smileys/classic/cool.gif)