How to fix diacritic issue on command prompt?
Notepad is opening your file with the wrong encoding. Try opening using the Open dialog box, and in the bottom selecting other encodings:
Note that Microsoft uses non-standard names for the encodings. "Unicode" is actually UTF-16LE, and "Unicode big endian" is actually UTF-16BE.
Setting the codepage to UTF-8 should help :
chcp 65001
The dir
result will then be encoded in UTF8.
If VBS cannot understand it as-is, for the file to be automatically recognized under Windows as UTF8 you will need to prefix it with the UTF8 BOM bytes :
0xEF, 0xBB, 0xBF
You can then start with a file containing the BOM and append to it rather than write :
chcp 65001
copy EFBBBF.txt a.txt
dir /b /on B*.* >> a.txt
Or you may use copy /b
to concatenate the files.