Solved

How do I Xcopy to multiple destinations using a list in a .txt file?

Posted on 2008-10-10
4
4,408 Views
Last Modified: 2012-02-28
Machine - XP  
Server - 2003

Trying to run an Xcopy to copy a folder from a single server to multiple servers.  Would like to have the server list on a text document rather than imbedded in the xcopy.

This is the general idea of what I am trying to do, but it just tries to copy to "\\c:\svrlst.txt\vol1\installs"
for %%a in (c:\svrlst.txt) do xcopy c:\folder \\%%a\vol1\folder /e /i

---svrlst.txt---
server1, server2, server3
----------------

I know the following line works, but I would like the list in a txt file that is easier to manage:
for %%a in (server1, server2, server3) do xcopy c:\folder \\%%a\vol1\folder /e /i
0
Comment
Question by:craigshaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
robsantos earned 125 total points
ID: 22689082
does this help?

http://www.experts-exchange.com/Programming/Languages/Scripting/Q_23141541.html

(looks like you may be missing a "/f" after your "for" statement, like:

for /f %%a in......
0
 
LVL 15

Expert Comment

by:tenaj-207
ID: 22689127
You could use the set command in your batch file.  the batch file would look like this.

Set svr1=server1
set svr2=server2
set svr3=server3

xcopy c:\folder \\svr1\vol1\folder /e /i
xcopy c:\folder \\svr2\vol1\folder /e /i
xcopy c:\folder \\svr3\vol1\folder /e /i
0
 

Author Closing Comment

by:craigshaf
ID: 31505081
Thank You - one little /f off, and pow, it worked.  Also had to change the list to a single column and ditch the commas
0
 

Author Comment

by:craigshaf
ID: 22689146
Thanks tenaj, not exactly what I was looking for.  the /f switch made the difference I needed.
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question