Batch File Error
Weird Characters Causing Batch File Error
is not recognized as an internal or external command, operable program or batch file
That’s the error I was getting, weird considering the only thing (after removing everything else) in the file was @ECHO OFF. The ‘weird’ characters are shown in the little snippet below
After a bit of head scratching I opened notepad++, switched on ‘Show all characters’…nothing strange there. I had seen this before but I can never remember….then I did! Remember that is, the problem was the file, when it was created (by visual studio…as a txt file), was created with UTF-8 encoding, needs to be ANSI for batch files (or at least it can’t be UTF-8).
Green indicates ‘good’ encoding for batch files, red bad.
With notepad++ you can see what the encoding is (under Format) and change it. I changed my batch file to ANSI and voila it works!
I’ve blogged it so I can remember next time 🙂