[英]How to make Unicode charset in cmd.exe by default?
866 charset installed by default in Windows' cmd.exe is poor and inconvinient as compared with glorious Unicode. 与光荣的Unicode相比,Windows的cmd.exe中默认安装的866个字符集差劲且不方便。
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 65001 changes encoding only in the running console. 我了解chcp 65001仅在运行的控制台中更改编码。 I want to change charset at the system level.
我想在系统级别更改字符集。
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位),因此我决定尝试其他解决方案:
Run
(Win+R) Run
(Win + R) cmd /K chcp 65001
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
。
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
Open an elevated Command Prompt (run cmd as administrator). 打开提升的命令提示符(以管理员身份运行cmd)。 query your registry for available TT fonts to the console by:
通过以下方式在注册表中查询可用的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
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
CodePage设置为0xfde9(十进制为65001)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.