Change CodePage in CMD permanently?

2019-01-14 18:58发布

问题:

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?

回答1:

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"



回答2:

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'


回答3:

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.



回答4:

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.



标签: cmd codepages