Board logo

标题: [其他] Robocopy /UNILOG 参数生成的日志实质是GBK的编码? [打印本页]

作者: 523066680    时间: 2014-12-14 13:39     标题: Robocopy /UNILOG 参数生成的日志实质是GBK的编码?

本帖最后由 523066680 于 2014-12-14 13:52 编辑
  1. robocopy /L /MIR /copyall /TEE "%src%" "%dst%"  /XD %fold% /XF %file% ^
  2.          /UNILOG:"UniLog%dt:/=-%.txt" /X /FP /NS /NDL /NP
复制代码
其中 /UNILOG 参数的作用

     :: 以 UNICODE 方式将状态输出到日志文件(覆盖现有日志)。

实际执行后生成的文件,开头两个字节是UTF-16LE 的BOM \xFF\xFE
但是后面的内容全都是GBK编码的,Are you kidding me?
  1. ff fe
  2. 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d
  3. 20 20 20 52 4f 42 4f 43 4f 50 59 20 20 20 20 20 3a 3a 20 20 20 20 20 57 69 6e 64 6f 77 73 20 b5 c4 bf c9 bf bf ce c4 bc fe b8 b4 d6 c6 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
  4. 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d
复制代码
对应
  1. -------------------------------------------------------------------------------
  2.    ROBOCOPY     ::     Windows 的可靠文件复制                              
  3. -------------------------------------------------------------------------------
复制代码
WIN7 32位
作者: 523066680    时间: 2014-12-14 14:01

这里有一个相同问题的帖子(可能要翻*访问):
http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/windows-7-robocopy-unilog-option-appears/83d01ade-7dc7-4094-9dd0-90369b4bbced

Question
Windows 7 robocopy /UNILOG option appears completely broken

I tried to use /UNILOG:logfile with robocopy and the output file is corrupt.

It has the UNICODE BOM (FFFE), but the characters that follow are ANSI, except for the line of text
following "Options :", which does consist of actual UNICODE characters.  However, immediately following
that, it reverts back to ANSI, and if any of the files/paths in the listing really had a wide character, it is
obliterated (appears as a single '?', so not even UTF-8).

I don't suppose there's any hope to see this fixed, since the story on Windows 8 robocopy is that it
has even more bugs?





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2