Reputation: 199
I am making a batch file to copy some directories and subdirectories to a safe place (backup purposes). But if the path contains special characters like ® the script does not work.
:: Call Of Duty® 2
xcopy "F:\Archivos de Programa\Call Of Duty® 2\main\players" "D:\BackUp\savegames\Call Of Duty® 2\main\players\" /E /F /Y
In console the ® shows up as « , so a "not found" exception shows up.
I have tried using UTF-8 and ANSI codification but none of those worked.
Upvotes: 3
Views: 3130
Reputation: 605
I think it will work if you also change the code-page of the console to 65001, which is "kind of" a UTF-8 codepage. To do this you must add a command to your batch-file:
:: Call Of Duty® 2
chcp 65001
xcopy "F:\Archivos de Programa\Call Of Duty® 2\main\players" ^
"D:\BackUp\savegames\Call Of Duty® 2\main\players\" /E /F /Y
For more information on 65001 read: Is codepage 65001 and utf-8 the same thing? or google 65001+"UTF-8"
Upvotes: 5