Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to create a simple script that will robocopy several folders using the command below. When one folder is done copying, it moves on to the next. Does anyone have a batch/powershell for loop example for this? I've searched around but couldn't find anything.


share|improve this question
Copy parent folder instead? – HopelessN00b Dec 17 '12 at 19:07
Your terminology is confusing; are you sure you didn't mean \\sourceserver\share\folder ? – 1.618 Dec 17 '12 at 19:08
The title is confusing as well, there is no loop. – Peter Hahndorf Dec 17 '12 at 20:12
I'll see if I can update the title. I was looking for a "for loop" that would process each command in order. – RomeNYRR Dec 17 '12 at 20:59

1 Answer 1

up vote 4 down vote accepted

I don't quite understand your question but it seems to me that it's a simple matter of creating a batch file thusly:




share|improve this answer
Hi Joe, thanks for the response. To clear things up, I just want to create a batch script that will run exactly what you posted above, in order. If I were to put that in a script, would it complete FOLDER1 copy and then move on to FOLDER2 when it's done, or would it kick them all off at the same time? – RomeNYRR Dec 17 '12 at 19:40
A batch file like the one above would process one line at a time in order. So it would process line 1 and then when line 1 completes it will process line 2, etc. – joeqwerty Dec 17 '12 at 19:47
Thanks Joe, you rock! – RomeNYRR Dec 17 '12 at 20:02
Glad to help... – joeqwerty Dec 17 '12 at 20:03

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.