Robocopy变成了一个无休止的循环 [英] Robocopy become a endless loop

查看:85
本文介绍了Robocopy变成了一个无休止的循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C:\ batch中有一个robocopy批处理文件.这是批处理文件:

I have a robocopy batch file in C:\batch. Here is the batch file:

set LOG="C:\Log\robolog.txt"
set START1="C:\WORK"
set END1="\\fs-02\Work"

Robocopy %START1% %END1% /MIR /PURGE /SEC /SECFIX /R:1 /W:5 /V /ETA /LOG:%LOG%

我的问题是,如果我从包含此批处理文件的位置(c:\ batch)中打开 cmd 并从那里运行它,它只会一遍又一遍地运行它,并且永远不会结束. ..而且我什至无法终止 cmd .... Ctrl+C只会加快循环速度...

My question is if i open cmd from the location (c:\batch) that contains this batch file and run it from there, it just runs it over and over again and never ends....and i can not even terminate the cmd.... Ctrl+C will only speed up the loop.....

但是如果 cmd 的起始位置在其他位置,则批处理文件将运行并完成得很好.

but if cmd start location is somewhere else, the batch file runs and finishes well.

有人知道为什么我不能直接从包含它的位置运行此robocopy批处理文件吗?

Any idea why I CAN NOT run this robocopy batch file directly from the location that contains it?

推荐答案

Robocopy Endless Batch Script Loop Fix

原因

例如,如果您有一个名为Robocopy.cmd的批处理脚本,则执行该脚本时将出现无限循环.

If you have a Batch script with the name Robocopy.cmd for example, you will get an endless loop when you execute the script.

发生在我身上

我正在测试并注意到这一点,但不知道使脚本名称与命令相同将导致

I was testing and noticed this but didn't know having the name of the script the same as the command will cause Robocopy to endlessly loop. It worked from command line but looped endlessly from the batch script once it was executed.

解决方案

不要将您的批处理脚本仅命名为Robocopy并将其重命名为其他名称,例如Robocopyzzzscript123

Don't have your batch script named just Robocopy and rename it to something different e.g. Robocopyzzz, script123, etc.

这篇关于Robocopy变成了一个无休止的循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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