I need to recognize a unicode special character into CMD console, the special char is this: – (it's like a normal dash but it's not. It is the U+2013 character according to Wikipedia.
PS: you can find that character in the filename by downloading any file to your PC... Not all the downloaded filenames have that character but many servers transcodes the normal dash by that dash in the filename of the downloaded file and I don't know why...
If i have an MP3 file with that char in the filename, and then I try to do a "dir /B"command in the cmd then I get this:
C:\>dir /B
this is a - test.mp3
At this part all is ok... But what happens if I copy the filename to the clipboard (direct from the "dir" output) and I try to rename the file?:
C:\>REN "this is a - test.mp3" "badchar.mp3"
El sistema no puede encontrar el archivo especificado.
PS: The error in English says "The system cannot find the specified file."
So how I can do to recognize that char?
I've tried changing the CHCP codepages, tried to start a unicode CMD (CMD /U), tried to do the trick with "copy con" command, tried string character replacing... But nothing...
I don't want to use third-party apps like massive renamers because strictly I need to recognize natively the character as I need to process some files with the "dir" command...
The problem is that the "dir" command recognizes the character... But after that, how can I test any other command with that file? If only "dir" command recognizes it and I need to open that file into a external app... :(
Thanks for reading.
DETAILS:
A sample filename:
Ambassador Inc. – It's All Confusion.mp3
A detailed sample script of the problem:
@echo off
FOR /F "tokens=*" %%# in ('DIR /B *.mp3') do (
Echo "%%#"
RENAME "%%#" "fucking unicode dash that i can't delete it.."
REM any_program.exe "%%#"
)
pause&exit