windowsunicodecmd

How to get a directory/file name with UTF-16 (Unicode) characters displayed correct by cmd.exe in command prompt window?


I've created the directory •◘▬¨ŤlCęół♥☺☻0 and I would like to make it visible with the command dir /b. So far, the commands chcp 10000, chcp 10001 and chcp 65000 (UTF-7) failed.

The original name was displayed with:

The system cannot write to the specified device

Or the directory name was displayed with an empty string, or Unicode characters were replaced/ignored on output.

What is the reason and how to fix it?

The official documentation of Microsoft for the Windows command chcp isn't helpful :(


Solution

  • Yeah,I've just resolved my problem. It was a fault of default font in cmd.exe which can't manage unicode signs. To fix it(windows 7 x64 pro):

    1. Open/run cmd.exe
    2. Click on the icon at the top-left corner
    3. Select properties
    4. Then "Font" bar
    5. Select "Lucida Console" and OK.
    6. Write Chcp 10000 at the prompt
    7. Finally dir /b

    Enjoy your clean UTF-16 output with hearts, Chinese signs, and much more!