2

I would like to echo the unicode character "é" in cmd via running bat file. I prepared a short script:

@echo off
SET message=Gép3
echo %message%
pause

how can I do that? Is there a possibility to put directly this letter into the code?

Jozsef Garab
  • 171
  • 1
  • 2
  • 8
  • Press Alt + 232 on number pad number keys. Type `charmap` in Start Run dialog (Winkey + R). Select Dos Western Europe or whatever your region is. CMD use DOS character set. –  Oct 27 '16 at 09:32

1 Answers1

4

Do this (both are important):

  • Use code page 65001 (UTF-8) chcp 65001
  • When you save your .bat file, use UTF-8

i. e. edit your example code in this way:

@echo off
chcp 65001
SET message=Gép3
echo %message%
pause

Again, it is important that you save your .bat file with encoding UTF-8

morgano
  • 17,210
  • 10
  • 45
  • 56
  • But that's unnecessary, and means it won't work on any other computer. Alt + 232 does what you want WITHOUT any changes to the environment. –  Oct 31 '16 at 23:49