Solve the problem of Chinese garbled output by cmd

I wrote a batch file, read a number in the dos window and output it, Chinese characters are garbled
As shown

->Take the symptoms but not the root cause:

I need to use the chcp command, and I can’t understand the explanation. Anyway, it should be something similar to character encoding. Nnn represents the code page number (a system character set), and the most universal UTF-8 encoding number is international It is 65001
See picture
adding the following code to the above test.bat file, the Chinese garbled is solved, but this way is troublesome, you need to add the sentence every time

chcp 65001
->Troubleshooting the symptoms and the root cause (but there is a fatal flaw, especially for my patriotic English)

We can add a string variable in the calculator's registry, find the following folder, right click to create a new "string value", fill in and save as follows.
As shown
This method uses UTF-8 encoding, then It means that the default display of your cmd code page is not Chinese, but English, so I still adopted the first method

Guess you like

Origin blog.csdn.net/weixin_43311695/article/details/108181531
Recommended