Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-10
4
Medium Priority
?
4,455 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
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…

688 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