Change the Windows command-line font

Source: Internet
Author: User

Regular work will occasionally use the Windows command line, compile a small program or use some command-line programs or something, but the Chinese version of Windows command line optional font only dot matrix font and the new song body, I do not like. A search on the internet found that the problem originated from the code page settings of the Windows command line. The code page is the product of the development of character coding, this article is no longer detailed, interested students can pay attention to my column "The Essence of coding." Let's look directly at how to solve this problem, as described in Windows 7, but should be suitable for most versions of Windows systems.

First, the default situation

The effect by default is as follows:

This font is a little use, if you want to use it every day, I will be crazy, especially the effect of Chinese characters, people can not bear to look directly.

To open cmd, click the upper left icon and select Properties from the System menu that appears, the Properties window will appear as shown below. You can see that the current code page of the CMD program is 936, and the encoding used is GBK. Then switch to the Font tab to see the optional fonts.

The font list has only the dot matrix font and the new Arial, this problem stems from the Windows setting of the console program, open the registry to locate the [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Nt\ Currentversion\console\truetypefont], you can see the TrueType font settings for the Console program under Windows.

We can see a few string values of 936. Each item corresponds to a code page, such as 936 for Simplified Chinese, 950 for traditional Chinese, and so on. Both 0 and 00 (000 is what I add) two are more special, in fact, these two are code page 437 corresponding font. In other words, in addition to code page 437, other code pages can only specify one available font, or you will use a bitmap font.

Second, the solution

Since the root of the problem has been found, it is easy to solve. If you don't use a font other than the default font, you can simply switch the code page to 437 and choose the font you like. Of course, the code page 437 is available by default the font is also only Lucida Console and Consolas,lucida console effect is not flattering, consolas I think it is quite good. How does the code page switch? Very simple chcp [codepage] can.

Now let's look at the optional font for the property page.

You can see the Consolas and Lucida Console in the Font list, and select Consolas to see the effect.

It's good, huh? However, if you want to use more fonts as much as I do, or if you are not satisfied with the effects of Consolas in the command-line program, consider adding fonts that are available to the command-line program. To add fonts is also very simple, in the registry [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Nt\currentversion\console\truetypefont] Add a string value with the name 000 and set its value to the name of the font you want to use, and if you want to add more fonts, just add a string value and name it 0000, which means add a 0. I added a font named Bitstream Vera Sans Mono, you can choose any font you want to use, and of course it has to be in the system.

Select Bitstream Vera Mono, then look at the effect ~

It's a lot more pleasing to me, huh?

three, two points of attention
    1. Some students say that in the code page 437, the Chinese display has a problem, this I have not encountered. If you do encounter such a problem, you can try to change or add the font first as I said earlier, and then switch the code page to 936.
    2. The preceding method applies not only to command prompt program CMD, but also to PowerShell.

Change the Windows command-line font

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.