1

On my Windows 10 machine I am trying to run a "robocopy" command to backup files.

Everything is fine as long as the paths (to folders to backup) do not contain letters like ö, ü, ä which whoever is inevitable as this is a German environment.

Earlier I was able to fix this by sending a

chcp 1252

command first, so that the command prompt window runs on Code Page 1252 which has these characters. But this was on a Windows 7 machine then.

Now with the Windows 10 machine this does not have effect for me.
The code page is provably set to 1252, and still the robocopy command does not run.
(The default code page of this system is 850, by the way.)

robocopy C:\Users\Myself\Documents\Notizbücher ^
  Y:\RobocopyBackups\001_NotizbücherBackup /e /mir /np /z /tee ^
    /log:Y:\RobocopyBackups\001_Backup_log.txt

When I run this, the "ü" always gets messed up, and the command cannot be run since the computer does not find the (messed up) address.

I tried all sorts of things

  • Sending first chcp 1252

  • Making sure that my .bat file where I keep the code is encoded as Windows-1252

  • Trying chcp 65001 for UTF-8 (with and without encoding the .bat file similarly)

  • Trying chcp 2851 for ISO-8859-1, just for fun...

It's always the same: the "ü" gets messed up.

Of course, I could just remove the "ü" from the folder names. But I want to have a clean solution, not such a lame workaround.

What could I do?
Note: I am using Notepad++

Io-oI
  • 9,237

1 Answers1

4

Solution found after doing all sorts of experiments:

Theory

As the code page used by default on the system is Code Page 850 (part of the "OEM" series of code pages), I decided to give it a try and save my .bat file with exactly that encoding.

Practice

As I am using Notepad++ for writing, I used Notepad++'s "Encode" option in the menu and selected there

[Menu] -> Encode --> Character sets --> Western European --> OEM 850

(And of couse I also removed the chcp 1252 command from the batch.)

Result

Surprise or not, the system now accepts my batch commands includin German umlaut characters (ö,ä ü).

Note for newbees (like me)

For finding out what the current (default) code page of your system is, enter

chcp

into your command prompt. It should then return the current value, in my case: 850.