问题
I have a ton of files containing em dashes within the file name.
I am having trouble renaming them, as cmd apparently fails to recognize it, and converts emdash into a regular dash.
As a result I get the following error after I run the ren command:
ren "MyFile With – EmDash.txt" "MyFile.txt"
The system cannot find the file specified.
Things I have tried
Inserting
chcp 65001at start of batch code.This command does not seem to work.
Saving the batch file as ANSI in Notepad
What this does is basically the following:
ren "MyFile With û EmDash.txt" "MyFile.txt"
The system cannot find the file specified.
As one can guess apparently saving ANSI format changes a character stored as em dash in notepad to û when batch file runs in a cmd window.
I have got dozens of files which need this renaming, and this would be monotonous to do so without a batch script.
来源:https://stackoverflow.com/questions/53693969/rename-files-having-emdash-using-a-batch-file