Sounds like you don't need a batch file, but just for /R %X in (*.xml) do dos2unix -r %X
utf-16,byte-order-mark,dos2unix
That 0x0004 character you are seeing in your file has nothing at all to do with the BOM (which is fine, by the way) -- it's an EOT (End of Transmission) character from the C0 control set, and has been at that codepoint since 7-bit ASCII was the new hotness....
It turned out the problem is really simple. What I am doing with my scripts is calling them like below: expect script.exp > mylog As told in the description, mylog contains ^M line-endings when opened in Vim or using cat -v mylog. To get rid of them in real-time, I...