Tag Archives: encoding

Windows console encoding

Filenames on NTFS are encoded in UTF-16.  The windows console is set by default to some other encoding entirely.  This makes working with files with ‘special’ characters in the filenames impossible…

In my case, I was using the following common code to delete files and folders in a directory:

set folder=”C:\test”

cd /d %folder%

for /F “delims=” %%i in (‘dir /b’) do (rmdir “%%i” /s/q || del “%%i” /s/q)


But files with certain unicode characters were not being deleted.  To fix this, add the following at the top of the file:

chcp 10000


This changes the encoding to UTF-16.

Or if you’re using cmd and the dir command, change the font first to Lucida Console (as the default font has a very limited character set).