Help with for loop

  • Thread starter Thread starter Marc Coxall
  • Start date Start date
M

Marc Coxall

i am trying to write a script that will loop around a provided list of servers

what i want to di is somthing like

for i in server1 server2 server3 server4 server5
do
copy c:\file.txt \\%i%\c$\folder\file.txt
done
 
Marc said:
i am trying to write a script that will loop around a provided list of servers

what i want to di is somthing like

for i in server1 server2 server3 server4 server5
do
copy c:\file.txt \\%i%\c$\folder\file.txt
done

In a batch file:
for %%i in (server1 server2 server3 server4 server5
) do copy c:\file.txt \\%%i\c$\folder\file.txt

if the list is in a text file one server in a line,

for /F %%i in (file.txt) do c:\file.txt \\%%i\c$\folder\file.txt

HTH
 
Back
Top