I have a program, led, that can do this. Say your program is foobar and is executed with "foobar src.txt", and you want to apply it to all files in the current directory, you could do
dir *.dat /b | led "_#ifoobar #g999#i >> output.txt" | cmd
If you wanted to store the output from processing each .dat file into a .txt file with the same name, for example x.dat -> x.txt, you could do
dir *.dat /b | led "_#C#F.dat#d4#i.txt#g0#ifoobar #P#i > #" | cmd
I wrote the program originally for Windows. The "_#" changes the delimiter to #. On Windows, you can skip that part and use $ as a delimiter. Thus, the last command becomes
dir *.dat /b | led "C$F.dat$d4$i.txt$g0$ifoobar $P$i > $" | cmd
[This message has been edited by eric76 (edited 5/27/2011 6:29a).]