Windows – Xcopy complete operation successfully, but the copy does not occur

batch-filebatch-processingwindowswindows-server-2008-r2xcopy

i'm having a weird problem about copying with Xcopy.

I'm using Windows Server 2008 R2. There is a Batch file (.CMD) – in fact, 2 Batches – which executes many operations. Among them there are 2 Xcopy.

The first Xcopy completes the copy successfully. Then some operations of batch are executed and…the second Xcopy is executed after some time. It shows a successfully status, like "300 files copied" but…the files are not copied !

THE strange behaviour: i put a pause command into the Batch and, after this second weird Xcopy, i run THE SAME command at the Prompt and..it works !!!

I cannot explain this, so i'm asking for help here. The full command is:

xcopy /s /e /h /r /i /y E: D:

As a matter of curiosity/information, the other Xcopy (which worked!) is:

xcopy /s /e /h /r /i /y E: D:

Or….the same command !!! Each one runs in a separated Batch file – the first Batch "calls" the second one.

E: is CD-ROM, so after the first Xcopy, the first Batch asks for another Disc and calls the second Batch, which (supposed) copies entire CD content to D: (HDD).

I'm sorry if the question is silly and i'm not realizing how simple is to correct the erratic behaviour of Xcopy. Thanks in advance…

Best Answer

Thanks very much Bali C !

But i found the problem: the correct syntax is

xcopy /s /e /h /r /i /y E:\ D:\

You can see that the backslashes made all the difference ! The files were being copied to another directory, in fact, the current working directory. With backslashes the copy is fine.

But i appreciate your suggestion...

Related Topic