Is there a Windows command shell that will display

2019-01-02 18:19发布

Assuming I have fonts installed which have the appropriate glyphs in them, is there a command shell for Windows XP that will display Unicode characters? At a minimum, two things that should display Unicode correctly:

  • Directory listings. I don't care what I have to type (dir, ls, get-childitem, etc.), so long as files with Unicode characters in their names appear with the right glyphs, not the unprintable character box.
  • Text file content listings. Again, doesn't matter to me if it's 'less', 'more', 'cat', 'dog', etc., so long as the characters are printed. I recognize that this is more complicated because of character encoding of the file, so if I have to specify that on the command line that's fine with me.

Here's what I've tried so far:

  • cmd.exe
  • Windows PowerShell; including the multilingual version.
  • Cygwin bash

No luck. I even tried installing custom fonts for cmd/PowerShell. PowerShell and cmd.exe seem to be Unicode-aware in the sense that I can copy/paste the non-printable box out of there and it will paste into other apps with the correct characters. Cygwin (?) seems to convert to the ? character and that comes through in the copy/paste.

Any ideas?

12条回答
人气声优
2楼-- · 2019-01-02 18:26

Setting the codepage to UTF-8 with the command "chcp 65001" should help you print file contents correctly to the shell (using cmd.exe). This won't work for directory listings though (UTF-16 encoding in NTFS file names).

查看更多
素衣白纱
3楼-- · 2019-01-02 18:27

Try this:

powershell.exe -NoExit /c "chcp.com 65001"

Who uses msysgit:

powershell.exe -NoExit /c "chcp.com 65001; sh --login -i"

Do not forget to change font of window to TrueType font with UTF-8 support ("Lucida Console")

查看更多
看风景的人
4楼-- · 2019-01-02 18:27

For a true shell, try PowerShell Plus. You can select Unicode fonts and work with other languages, not only in the editor, but in the true console.

查看更多
心情的温度
5楼-- · 2019-01-02 18:28

A fast and convenient way to do it is on the Explorer.

    1. Open the Explorer window.
    2. Traverse to the top level of directory where you want to find.
    3. On the upper right corner, there is a find field.
查看更多
泪湿衣
6楼-- · 2019-01-02 18:29

This is how I can got Chinese output in cmd.exe running on Windows 7 Pro English Version. I also tried file names with Japanese, Russian, and Polish and they all seem to display correctly. Input also seems to work, at least when I tried to do a dir xxx* containing non-ascii characters.

  1. Install console2, which is a front-end to cmd.exe (and other shells)

  2. After installation, follow these instructions

    Delete the key HKEY_CURRENT_USER\Console\Console2 command window in the registry.

    Import the following data into windows registry:

    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Console\Console2 command window] 
    "CodePage"=dword:000003a8 
    "FontSize"=dword:000a0000 
    "FontFamily"=dword:00000036 
    "FontWeight"=dword:00000190 
    "FaceName"="細明體" 
    "HistoryNoDup"=dword:00000000
    
  3. You may or may not have to change the font. Initially I had the font set to @NimSum, and the Chinese characters came out rotated 90 degrees. Then I switched to NimSum (without the @) and it came out correctly. Then just out of curiosity I switched to Consola and yet I can still see the Chinese characters. So I'm not sure if you actually have to set the font or not.

查看更多
回忆,回不去的记忆
7楼-- · 2019-01-02 18:29

PowerShell V2 CTP3 inside Console2 seems to do that. The only downside is that the default console encoding is UCS-2 LE instead of UTF-8.

查看更多
登录 后发表回答