Visual Studio inserts invalid characters in batch files

Ray is correct when he says that Visual Studio’s default format for text is something like UTF-8. Although Notepad++ is a great tool and I use it myself, there is an alternative in that you can tell Visual Studio to store your text file in ASCII format:

In VS2008, select your file in the solution explorer and choose File…Save myfile.bat As…

On the down arrow on the Save button, choose Save with Encoding.

When saving in the Advanced Save Options dialog, Choose US-ASCII in the Encoding drop-down list. Set the line endings as required, or leave it as Current Setting.

Leave a Comment