Change CodePage in CMD permanently?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 22:59:33

问题


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:


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'



回答2:


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"




回答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:


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!




回答5:


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).




回答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.



来源:https://stackoverflow.com/questions/7432545/change-codepage-in-cmd-permanently

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!