robocopy无效参数“-” [英] robocopy invalid parameter "-"

查看:65
本文介绍了robocopy无效参数“-”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试完成批处理脚本,但在某些情况下会失败。

I am trying to complete my batch script but under certain circumstances it fails.

这是我正在运行的命令:

This is the command I am running:

ROBOCOPY "C:\test\dash2\Hello - 4\" "C:\test\dash2\Hello - 4\..\" /MOV

这是我得到的错误

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows

-------------------------------------------------------------------------------

  Started : Mon May 11 01:28:46 2015

   Source - C:\test\dash2\Hello - 4" C:\test\dash2\Hello\
     Dest -

    Files :
  Options : /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

ERROR : Invalid Parameter #2 : "-"

我确实将源和目标包围了两次特斯
但是根据ROBOCOPY日志,源和目的似乎是错误的

I do surround my source and destination by double quotes. But according to the ROBOCOPY log the source and dest seems to be wrong

编辑

似乎认为空格是分隔符,因此将-作为第二个参数。

It seems that it thinks the space is a separator, so it treats the "-" as the second parameter.

推荐答案

ROBOCOPY "C:\test\dash2\Hello - 4\" "C:\test\dash2\Hello - 4\..\" /MOV
                                 ^                             ^

删除转义的结尾反斜杠

已编辑以适应注释

如果源和目标是变量并除去反斜杠是一个问题,可以使用

If source and destination are variables and removing the backslash is a problem, this can be used

robocopy "%source%\." "%target%\."

这篇关于robocopy无效参数“-”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆