我在文件名中有大量包含em破折号的文件 . 我无法重命名它们,因为cmd显然无法识别它,并将emdash转换为常规破折号 . 因此,在运行 ren 命令后,我收到以下错误:

ren "MyFile With – EmDash.txt" "MyFile.txt"   
The system cannot find the file specified.

我尝试过的事情

  • Inserting chcp 65001 at start of batch code.

此命令似乎不起作用 .

  • Saving the batch file as ANSI in Notepad

这样做基本上如下:

ren "MyFile With û EmDash.txt" "MyFile.txt"
The system cannot find the file specified.

可以猜测,当批处理文件在cmd窗口中运行时,显然保存 ANSI 格式会将记事本中存储为em dash的字符更改为 û .

我有几十个需要重命名的文件,如果没有批处理脚本,这将是单调的 .