craigshaf
asked on
How do I Xcopy to multiple destinations using a list in a .txt file?
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\inst alls"
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
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\inst
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You - one little /f off, and pow, it worked. Also had to change the list to a single column and ditch the commas
ASKER
Thanks tenaj, not exactly what I was looking for. the /f switch made the difference I needed.
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