Using box-drawing Unicode characters in batch files

If you want to write console batch files that use those characters, you need an editor that will save the batch file using the console’s code page. To check what that is, type:

C:\>chcp
Active code page: 437

This is the result for my US Windows system. Western European versions of Windows will often be code page 850.

A good editor is Notepad++. Set that encoding in the editor (Encoding, Character sets, Western European, OEM-US) and copy the following characters into it:

@echo off
echo ╔═╦═╗ ┌─┬─┐ ╓─╥─╖ ╒═╤═╕
echo ║ ║ ║ │ │ │ ║ ║ ║ │ │ │
echo ╠═╬═╣ ├─┼─┤ ╟─╫─╢ ╞═╪═╡
echo ║ ║ ║ │ │ │ ║ ║ ║ │ │ │
echo ╚═╩═╝ └─┴─┘ ╙─╨─╜ ╘═╧═╛

Save the file as test.bat and run it from the console:

C:\>test
╔═╦═╗ ┌─┬─┐ ╓─╥─╖ ╒═╤═╕
║ ║ ║ │ │ │ ║ ║ ║ │ │ │
╠═╬═╣ ├─┼─┤ ╟─╫─╢ ╞═╪═╡
║ ║ ║ │ │ │ ║ ║ ║ │ │ │
╚═╩═╝ └─┴─┘ ╙─╨─╜ ╘═╧═╛

When you open the file again in Notepad++, it is possible that you will see something like:

@echo off
echo ÉÍËÍ» ÚÄÂÄ¿ ÖÄÒÄ· ÕÍÑ͸
echo º º º ³ ³ ³ º º º ³ ³ ³
echo ÌÍÎ͹ ÃÄÅÄ´ ÇÄ×Ķ ÆÍØ͵
echo º º º ³ ³ ³ º º º ³ ³ ³
echo ÈÍÊͼ ÀÄÁÄÙ ÓÄÐĽ ÔÍÏ;

Since there is no indication in the file what code page the characters in it represent, Notepad++ may choose the so-called ANSI code page. On US Windows that is Windows-1252. Just select the OEM-US encoding again to display it properly.

Leave a Comment