CMD: '■m' is not recognized as an internal or external command

In addition to the approved answer I would add the case where is a PowerShell command the one that creates the file... PowerShell comes by default with the UTF-16 encoding.

To solve your problem then, force the file encoding lie this: | out-file foo.txt -encoding utf8

Answer based on this other answer.


What text editor are you writing this in? It seems like your text editor may save the file as UTF-16 encoded text, which cmd.exe can't handle. Try setting the "coding"/"file encoding" to "ANSI" when saving the file.

This results in the first byte being a byte-order-mark (telling other editors how to process the file), and cmd.exe can't deal with this.