Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using a batch file, suppose a directory on a network machine, mapped to a drive with net use.

net use \\"server name"\"share name" y:

Then from that directory

cd archive

An xcopy to another location on that drive.

xcopy *.* backup\

What behaviour would xcopy take? Would a temporary copy of *.* be sent to the host machine (the one on which the batch is started) only to be sent back to the destination directory, or would the copy be effected solely on the network drive?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

To answer your question: xcopy would read all the files from the server to the host machine and send them all back to the network drive.

share|improve this answer
As a complementary question, would it be possible to do the copy entirely remotely, that is, to not bring the files to the host temporarily? – MPelletier Jun 13 '11 at 19:03
Other than by starting a batch file on the server, I should say. – MPelletier Jun 13 '11 at 19:04
you may want to try psexec... it's similar to starting a batch file on the server, but... – bubu Jun 14 '11 at 3:44
Does anyone know if Robocopy uses this same behavior? – Brettski Sep 2 '11 at 16:26
Couldn't you create a scheduled task on the remote machine. Then remotely trigger that task using the local command schtasks /run /S {servername} /TN {taskname}? Maybe you could pass variables of the location and destination? – Yeodave Sep 14 '11 at 13:36

If there's an "archive" sub-directory, then the "cd" command will be successful at changing the current working directory.

The final "xcopy" command will copy only the contents of the current working directory to a sub-directory called "backup" that is relative to the current working directory (if that sub-directory doesn't exist, then xcopy may prompt you to confirm if you wish to have it created automatically, or it might even ask you if you wish to create a directory or a file).

(This all assumes, of course, that you have read/write access to the network drive Y: and that the mapping to drive Y: was successful.)

share|improve this answer
A better approach would be to copy to specific destinations instead of assuming that all the preceding commands were successful. For example: XCOPY "\\server name\share name\archive*.*" "\\server name\share name\archive\backup\" – Randolf Richardson Jun 13 '11 at 18:54
Good note. But as @bubu noted, there would be a temporary copy made to the host even with full paths, correct? – MPelletier Jun 13 '11 at 19:01
@MPelletier: XCOPY stores data in RAM (locally) before writing it. If the source and destination are on the same server, it doesn't matter, the data will still be transferred over-the-wire both ways. Novell had similar a tool called NCOPY which would instruct a NetWare server to copy data without sending it over the wire to/from the client (to conserve network bandwidth), and it could copy data much faster as a result. To realize the same effect, you'll probably just need to run the XCOPY command server-side. – Randolf Richardson Jun 13 '11 at 19:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.