I need the equivalent of the shell command
xargs < list.txt cat -- > compiled.txt as a Windows batch file.
There is a directory full of text files (about 50 to 500 files) that I need to concatenate into one file. The order is important. The files can't be named in asciibetical order, because the natural order is not the order it should be compiled in the target file.
I had the the idea to name the source files like
$DISREGARD1_$SECOND-ORDER_$FIRST-ORDER_$THIRD-ORDER_$DISREGARD2.txt and do some voodoo with it, but I think for my use case it is simpler and less volatile to maintain an ordered list. Concatenating from a list is very easy with xargs and cat. How do I do it with a .bat file on Windows?
I need it as an idempotent batch file so that the user can click on it. In the target file should be no command output, superfluous carriage returns or anything else that's not in the sources (i.e. like if the files were binary).
Bonus question: It would be great to allow remarks in the list file (empty lines not allowed in order to limit complexity). I'd do that on shell with sth. like
grep -v ^# < list.txt | xargs cat -- > compiled.txt. Any chance to get this into a .bat file as well?