找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 16391|回复: 1

[其他] Robocopy /UNILOG 参数生成的日志实质是GBK的编码?

[复制链接]
发表于 2014-12-14 13:39:09 | 显示全部楼层 |阅读模式
本帖最后由 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位

评分

参与人数 1技术 +1 收起 理由
yu2n + 1 不明觉厉~ XD

查看全部评分

 楼主| 发表于 2014-12-14 14:01:19 | 显示全部楼层
这里有一个相同问题的帖子(可能要翻*访问):
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?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 00:29 , Processed in 0.017709 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表