CMD Windows command prompt to set the default encoding

1. Problem Description

  Because Windows Chinese system, the command prompt, the default encoding is "Simplified Chinese GBK", code page number is 936.

   

  Developed commonly encoded as UTF8, when the manual switch must be operated coding  chcp 65001 

  

 

  At this time, in order to ensure prompt and input will not be garbled.

  But this is only an expedient measure and then restart the command prompt will become the default GBK, need to have a way to make the default command prompt changes to UTF8 encoding.

  Many posts say a change in the registry entry can:

  HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe
  修改"CodePage"=dword:0000FDE9

  Bloggers are directly installed Windows10 1903 Professional Edition, do not have this item in the registry, Microsoft should be canceled this item.

  

  Because Microsoft also wanted to give a good performance, more powerful alternative to the Power Shell command prompt, so in future versions will gradually replace lost command prompt. But bloggers accustomed to using the command prompt, although also experience the powerful Power Shell, or accustomed to using the command prompt, so determined to change it.

 

2. Solutions

  Since the system software is based on the registry saved configuration, the configuration command prompt must also be based on the registry. Directly modify the hexadecimal value is very troublesome, it is better to start elsewhere. When can manually switch the command prompt encoding, are not in the registry, so that the command prompt to start automatically modify the encoding command prompt it?

 

3. solve the problem

  (1) Press the "win" + "r" open "Run", type  regedit  and click OK to open the Registry Editor.

  (2) by category into the  HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Command Processor   directory.

  (3) the space on the right, right, select "New" - "string value."

    Value name: autorun

    Numerical data: chcp 936

  

 

  (4) re-open the command prompt will be displayed directly  Active code page: 65001  Description has been automatically changed to utf8 encoding.

  (5) In order to meet part of the program might be to use GBK coding, we need a simple one-click way to modify the default code. Create a .bat batch file, write the string inside.

@reg add "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Command Processor" / v "autorun" / t REG_SZ / d "chcp code page number" / f

  Chinese character part number for other modifications which, after saving the administrator can run with modified.

 

4. Other information

  (1) mainstream code page number as follows.

chcp 437 English 
chcp 932 Japanese 
chcp 936 Simplified Chinese 
chcp 950 Traditional Chinese 
chcp 65001 UTF-8

Guess you like

Origin www.cnblogs.com/NyanKoSenSei/p/11464952.html