Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to get robocopy in Windows 7 to generate a Unicode log, since I have files with Unicode characters. The command I used:

robocopy C:\mysource D:\mydest /mir /unilog:backup.log /tee

File the copy works and the onscreen output is correct, the log file itself just contains gibberish. This is regardless of whether I use the Command Prompt or the Powershell.

What gives? Am I doing something wrong?

share|improve this question
This is also my experience. Did you find a solution? – André Caron Jun 3 '12 at 16:49

It appears to be a bug in the XP27 version of RoboCopy (which comes with Windows 7). In version XP26 (which comes with Windows Vista) /UNILOG produces a perfectly readable Unicode log file for me. If you don't have a copy of Vista laying around EasyRoboCopy also comes with the XP26 version. (I haven't actually tried EasyRoboCopy itself, just extracted robocopy.exe out of its setup file using WinRAR.)

share|improve this answer

In your case, the command in Powershell goes something like this:

robocopy C:\mysource D:\mydest /mir | Out-File backup.log

The workaround is that you use Out-File instead of built-in /unilog parameter. You will get exactly the same log file, but now it will be properly written in unicode.

share|improve this answer
Sure it will be unicode, but there will be no special unicode characters. It's just ASCII output translated to unicode. – davor Apr 28 '13 at 7:17

Looking at the (binary) file output on Win7, the /UNILOG option is useless. It writes the standard UNICODE BOM (FFFE), but then proceeds to write all narrow characters EXCEPT for the options line (e.g., /BYTES /S /COPY:DATS ...), which is actual unicode. After that, it reverts back to ANSI chars, and it is not UTF-8, either; i.e., if you have a filename with a wide character in the path, it is converted to a narrow '?' character.

Apparently no interest in fixing it from MSFT, since it's been this way for some time, and I have all updates.

share|improve this answer

At a glance, I'd say the file written by Robocopy while using the /UNILOG and /TEE switches contains a UTF-16 little-endian byte order mark followed by an ISO-8859-1 terminal typescript.

To make it readable, I did the following in Ubuntu:

dd if=robocopy.log ibs=1 skip=2 obs=512        | # Strip the byte order mark
  iconv --from-code ISO-8859-1 --to-code UTF-8 | # Convert to UTF-8
  col -b > robocopy_utf-8.log                    # Interpret control characters

The resulting file matches what I saw in the Windows command prompt.

share|improve this answer
Any way to do similar conversion in windows? I have tried this conversion in pipe in PowerShell, but with no success:([System.Text.Encoding]::Unicode).GetString([System.Text.Encoding]::Con‌​vert([System.Text.Encoding]::GetEncoding(28591), [System.Text.Encoding]::Unicode, ([System.Text.Encoding]::GetEncoding(28591)).GetBytes($_))) – davor Apr 28 '13 at 8:26
This works!!!!! – Corey Nov 13 '13 at 3:17

If your file or directory names contain Unicode characters then before issuing the Robocopy command with the /unilog parameter use the chcp 65001 command.

Once you have the mangled Unicode log, just open it up in MS Word as Unicode (UTF-8) and save it:

MS Word File Conversion Dialog

share|improve this answer

I fixed my unreadable, Unicode-format Robocopy log files in Windows (which were accidentally created by appending normal Robocopy output to Unicode output from Out-File in PowerShell), as follows:

In PowerShell:

$bytes = [System.IO.File]::ReadAllBytes('C:\Temp\RoboCopyLog.txt')
$len = $bytes.Length
#Remove the Unicode BOM, and convert to ASCII
$text = [System.Text.Encoding]::ASCII.GetString($bytes,2,$len -2)

The above code may not work for all file sizes!

(Credit for code: I adapted code from this post by Ferdinand Prantl: Stackoverflow - Read/Parse Binary files with PowerShell

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.