19

My Windows cmd CodePage is now under 65001. Since I was doing some Android stuff and need to use console log, but forget how changing it now.

When using chcp 437 to change the CodePage back, it works. But if I start a new cmd window, it goes back.

How to do the chcp thing to make it pernament?

Lyn
  • 699
  • 1
  • 7
  • 17

6 Answers6

23

In the 1809 build of Windows 10 I've managed to permanently solve this by going to the system's Language settings, selecting Administrative language settings, clicking Change system locale... and checking the Beta: Use Unicode UTF-8 for worldwide language support box and then restarting my pc.

This way it applies to all applications, even those ones that I don't start from a command prompt! (Which was necessary for me, since I was trying to edit Agda code from Atom.)

Isti115
  • 2,418
  • 3
  • 29
  • 35
17

Here I found a better solution:

  1. Start -> Run -> regedit
  2. Go to [HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor]
  3. Add new String Value named: Autorun
  4. Change the value to 'chcp 437'
Community
  • 1
  • 1
Mojtaba Rezaeian
  • 8,268
  • 8
  • 31
  • 54
  • @Nikos That's easy to guess for anyone who is familiar with methods of keeping data on a computer or windows registry. The registry keys are commonly used to manage and categorize data/options and not keeping data or values themself. – Mojtaba Rezaeian Aug 31 '19 at 21:48
9

Create a start up batch file that includes all the commands you want.

Then edit the registry to point to your start up file.

http://technet.microsoft.com/en-us/library/cc779439%28WS.10%29.aspx

c:\startup.cmd

@echo off
chcp 437

HKLM\SOFTWARE\Microsoft\Command Processor
AUTORUN="C:\startup.cmd"

7

Command prompt code page always change back to the default 437 if you just use chcp 850 in cmd to change the active language code (850 = Multilingual (Latin I)). My system default language is set to English (437) although I'm Brazilian (language code 850). Once I need to show some special characters such as ã, õ, ç, I found that at Windows 10, under All Settings > Time & Language > Region & Language there is (at the top right corner) a link for Related settings - Additional date, time & regional settings. From there you'll be redirected to Control Panel\Clock, Language, and Region. Click again on Region > Change Location and at the window Region, at the tab Administrative, change the Language for non-Unicode programs by clicking the button Change system locale and choosing some other that uses the code you need (In my case, Portuguese (Brazil) = code 850). Restart Windows and check if your command prompt is now set to the new language code (type chcp in cmd). For me, it solved the problem. There is also a Latin (Word) option on the list that I suppose is also code 850.

Kuroi Mizu
  • 71
  • 1
  • 1
6

Setting the default CMD/shell Codepage can be neatly done using the following command:

REG ADD HKCU\Console\%SystemRoot^%_system32_cmd.exe /v CodePage /t REG_DWORD /d 437

This will make the codepage 437 your default, but ONLY in the cmd/shell, meaning the rest of the OS is safe and the boot environment ist untouched. Instead of always changing the codepage whenever the cmd opens, the cmd will open in the specified codepage from start.

If you wish to edit it manually using regedit.exe, beware that you have to set the codepage value in 'decimal' (use the radio-buttons for selecting decimal or hex input).

double-beep
  • 5,031
  • 17
  • 33
  • 41
TheUnseen
  • 314
  • 2
  • 6
  • 1
    On a sidenode: I'd highly discourage anyone from setting the default shell using HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP As this specifies not the cmd.exe environment but the complete windows shell environment at boot-time. This means all commands are evoked in this environment. The key specifies the **NON-UNICODE Fallback environment**, therefore setting this to a UTF Codepage (e.g. UTF-8) will inadvertently result in an unbootable Windows. – TheUnseen May 27 '19 at 09:32
-6

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage

You can edit code page value permanently by editing OEMCP key value in windows in above reg key value

Warning: Don't do it, it will make your system unable to boot. See related.

Community
  • 1
  • 1
  • 6
    Don't do it, it will make your system unable to boot. see http://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8 – laike9m Jan 24 '14 at 10:24
  • 1
    This answer may be removed. It's dangerous! – Aubin Feb 03 '14 at 22:38