Question & Answer
Question
How to change the codepage for DOS batch files to ANSI
Answer
The Windows command interpreter (CMD.exe) and thus any DOS batch file use a different codepage (437) than other Windows applications, like Notepad or the CD Command Line Interface (Direct.exe). This may cause issues with special characters.
For example when your batch file generates an input file for your Windows application from a directory listing. Any file name containing a special character, like a German umlaut, will not show up correctly in your Windows application and likely cause it to fail.
The solution is to
change the codepage at the beginning of your batch file using the CHCP
command.
To change the codepage to 1252 (ANSI - Latin I), type:
CHCP 1252
For more information on the CHCP command, type:
CHCP /?
Historical Number
HTG1152
Was this topic helpful?
Document Information
Modified date:
24 July 2020
UID
swg21562473