How do I permantly set the command-prompt codepage in Windows 7? [duplicate]
Open the registry editor (regedit
) and navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
Edit the OEMCP
value on the right and change it from the default (861?) to 1252.
Now open a new command-prompt and type chcp
to see the current codepage. (It may—probably?—will not take until you reboot.)
Another way you can do it is to add the chcp
command to the Autorun
key (you can set it for either a specific user or the whole system):
REGEDIT4
; Auto–code-page.reg
; Have chcp automatically run whenever a command-prompt is opened
;
;For current user
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"Autorun"="chcp 1252"
;For all users
;[HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor]
;"Autorun"="chcp 1252"
Open Control Panel. Choose Clock, Language and Region:
Then Change keyboard or other input methods:
Switch to the Administrative tab:
Click Change system locale under Language for non-Unicode programs and choose the desired language.
But yes, it changes:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP
and maybe other things.
Speaking of which, that's probably why changing OEMCP
to 65001
made the system unbootable. There's no such option in Control Panel.
(Screenshots taken from here as I don't have Windows with an English language pack at hand to make screenshots.)
Changing the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
makes my system unable to boot.
Adding a string value in
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor
of
"Autorun"="chcp 1252"
solved the problem.
I'm a user of Russian-localized Windows 7 x64 and so I need to set Code Page 1251 (Windows Cyrillic) as the default for CMD. The solution by Synetech as well as the solution by Steven Penny do work but with the latter only CMD will be affected and so for example the ping
utility will work incorrectly, so I decided to apply them both. At the same time changing default Code Page isn't sufficient: the default font of the CMD window does not support this encoding and I'm forced to set the Lucida Console
font as the default. The following .REG file does the whole work (changing the default codepage to 1251 and also setting Lucida Console
as the default font for CMD with proper properties):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"OEMCP"="1251"
[-HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
[HKEY_CURRENT_USER\Console]
; Code Page 1251
"CodePage"=dword:000004e3
; Default font for CMD window is "Lucida Console"
"FaceName"="Lucida Console"
"FontFamily"=dword:00000036
"FontSize"=dword:00140000
"FontWeight"=dword:00000190
"ScreenBufferSize"=dword:012C0064
"WindowSize"=dword:00190064
After importing this .REG file into the registry (by double-clicking on the file and choosing "Yes") you must reboot the system for the changes to take effect.