windows 默认情况下如何在 cmd.exe 中制作 Unicode 字符集?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14109024/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make Unicode charset in cmd.exe by default?
提问by Doctor Coder
866 charset installed by default in Windows' cmd.exe is poor and inconvinient as compared with glorious Unicode.
Windows 的 cmd.exe 中默认安装的 866 字符集与光荣的 Unicode 相比,性能较差且不方便。
Can I install Unicode by default or replace cmd.exe to another console and make it default so programms use it instead of cmd.exe?
我是否可以默认安装 Unicode 或将 cmd.exe 替换到另一个控制台并将其设为默认值以便程序使用它而不是 cmd.exe?
I understand that chcp 65001changes encoding only in the running console. I want to change charset at the system level.
我知道chcp 65001仅在正在运行的控制台中更改编码。我想在系统级别更改字符集。
回答by VerteXVaaR
After I tried algirdas' solution, my Windows crashed (Win 7 Pro 64bit) so I decided to try a different solution:
在我尝试了 algirdas 的解决方案后,我的 Windows 崩溃了(Win 7 Pro 64 位),所以我决定尝试不同的解决方案:
- Start
Run
(Win+R) - Type
cmd /K chcp 65001
- 开始
Run
(Win+R) - 类型
cmd /K chcp 65001
You will get mostly what you want. To start it from the taskbar or anywhere else, make a shortcut (you can name it cmd.unicode.exe
or whatever you like) and change its Target
to C:\Windows\System32\cmd.exe /K chcp 65001
.
你会得到大部分你想要的。要从任务栏或其他任何地方启动它,请创建一个快捷方式(您可以命名它cmd.unicode.exe
或任何您喜欢的名称)并将其更改Target
为C:\Windows\System32\cmd.exe /K chcp 65001
.
回答by Steven Penny
Reg file
注册文件
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"CodePage"=dword:fde9
Command Prompt
命令提示符
REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 0xfde9
PowerShell
电源外壳
sp -t d HKCU:\Console CodePage 0xfde9
Cygwin
赛格温
regtool set /user/Console/CodePage 0xfde9
回答by Alon Or
Open an elevated Command Prompt (run cmd as administrator). query your registry for available TT fonts to the console by:
打开提升的命令提示符(以管理员身份运行 cmd)。通过以下方式在您的注册表中查询可用的 TT 字体到控制台:
REG query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
You'll see an output like :
你会看到类似的输出:
0 REG_SZ Lucida Console
00 REG_SZ Consolas
936 REG_SZ *新宋体
932 REG_SZ *MS ゴシック
Now we need to add a TT font that supports the characters you need like Courier New, we do this by adding zeros to the string name, so in this case the next one would be "000" :
现在我们需要添加一个支持你需要的字符的 TT 字体,比如 Courier New,我们通过在字符串名称中添加零来做到这一点,所以在这种情况下,下一个将是 "000" :
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 000 /t REG_SZ /d "Courier New"
Now we implement UTF-8 support:
现在我们实现 UTF-8 支持:
REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 65001 /f
Set default font to "Courier New":
将默认字体设置为“Courier New”:
REG ADD HKCU\Console /v FaceName /t REG_SZ /d "Courier New" /f
Set font size to 20 :
将字体大小设置为 20 :
REG ADD HKCU\Console /v FontSize /t REG_DWORD /d 20 /f
Enable quick edit if you like :
如果您愿意,可以启用快速编辑:
REG ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
回答by Shaohua Li
Save the following into a file with ".reg" suffix:
将以下内容保存到带有“.reg”后缀的文件中:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"CodePage"=dword:0000fde9
Double click this file, and regedit will import it.
双击该文件,regedit 将导入它。
It basically sets the key HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\CodePage
to 0xfde9 (65001 in decimal system).
它基本上将密钥设置HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\CodePage
为 0xfde9(十进制为 65001)。