Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working with batch files in Windows, using both Notepad, and Notepad++. When I run the batch files, which all start with @echo off, I see the first line (when running on two separate machines) reading ´╗┐@echo off, and then all the REM lines below it appear as well.

I have tried changing the encoding in Notepad++, but it claims they are already at UTF-8 encoding, which appears to be correct.

What do I need to do to get these files to run properly?

share|improve this question

It looks like the DOS ASCII encoding of the Byte Order Mark for UTF-8 (0xEF 0xBB 0xBF):

In Notepad++ try encoding it as "UTF-8 Without BOM" or as plain ASCII. I think the use of BOM for UTF-8 is discouraged for this reason, it's not exactly backwards compatible with ASCII.

share|improve this answer
Absolutely right, except the 'DOS ASCII' is DOS code page 850, as shown by experimention in Python: >>> print u'\ufeff'.encode('utf8').decode('cp850') ´╗┐ – deltab Jun 17 '14 at 6:00
@deltab Ah, good find. I wasn't sure what the encoding was specifically called, just that I hadn't seen the line-art characters ╗┐ since the days of MS-DOS 5/Windows 3.11. Modern Windows must run batch files with that encoding for compatibility? – baochan Jun 17 '14 at 13:34
up vote 6 down vote accepted

Turns out it needs to be set to ANSI encoding to work properly. To set this, I chose Encoding->Encode in ANSI.

To figure this out, I tried to create a batch file from the command line.

echo @echo off > batch.bat
echo REM Some comment... >> batch.bat
echo echo Hello world! >> batch.bat

I then opened this file up in Notepad++, and checked the encoding in the lower right corner, which read ANSI as UTF-8. I don't know why it adds that last bit, but it seems to work now.

share|improve this answer
ANSI is not really an encoding. Presumably it refers to your Windows system's default code page. That will vary from one system to another, depending on configuration. – Cody Gray Jun 17 '14 at 8:11
This is not correct. The BOM is a character set encoding artifact. – Thorbjørn Ravn Andersen Jun 17 '14 at 8:20
@ThorbjørnRavnAndersen Who's incorrect, me or Cody? – Canadian Luke Jun 17 '14 at 15:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.