Robocopy becomes an endless loop

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%

My question is, I open cmd from the location (c: \ batch) that contains this batch file and run it from there, it just runs it again and again and never ends .... and I can't even finish cmd .... Ctrl+Conly speed up the cycle .....

but if cmd the starting location is somewhere else, the batch file works and finishes fine.

Any idea why I CANNOT RUN this robocopy batch file directly from its location?

+4
source share
2 answers

Robocopy Endless Batch Script Loop Fix

Cause

If you have a batch Script named Robocopy.cmd, for example, you will get an infinite loop when the script is executed.

Happened to me

I tested and noticed this, but did not know if the Script name is the same as the command invokes Robocopy for an infinite loop. It worked from the command line, but ended infinitely from the Script package after it was executed.

Decision

You do not have your Script party named just Robocopyand rename it to something else, for example. Robocopyzzz, script123etc.

+2
source

Since @MCND and @foxdrive already commented on solutin /, the reason is that the file has the same name as the command itself.

0

Source: https://habr.com/ru/post/1535939/


All Articles