:: For supporting all of the box-drawing characters choose one out of
:: Save the current OEM code page (in order to be able to reset it later on).įor /f "tokens=2 delims=:" %%i in ('chcp') do set /a oemcp=%%~ni How can I make sure my batch file can produce these box-characters consistently (to file and screen) on any system? I want to share my script with other people running other Windows versions and (maybe) different languages. I think it's something to do with "code pages". If I copy and paste that letter into the on-screen echo commands in my script, they appear "correctly" as box-characters when I execute the file. If I do it in Wordpad, the accented capital letter appears. If I hold down the ALT key and type a 3-digit code (from the link above) in Notepad or Notepad++, the relevant box-character appears. (The ones output to the text file appear fine.) except the box-characters echoed to the screen appear as capital accented characters. The status bar shows that the file is encoded in UTF-8, but (unlike in Windows Notepad) the batch file saves and runs fine. I tried using Notepad++ and can paste and save a file with a box-character in it. Unfortunately, it seems that batch files need to be in ANSI format to work.īut. If I copy and paste them into Notepad and try to save the file, I get a message warning that I'm using non-ANSI characters and need to change the encoding of the file. For aesthetic reasons, I now want to use box-characters like the ones shown at the top of the fourth column here: I'm using the "echo" command to write text both on-screen and to a text file.