I have below batch script to copy file from my computer to many computers.
@echo off
xcopy D:\some.txt \\10.124.66.72\texts
xcopy D:\some.txt \\10.294.66.46\testfolder
pause
In the script, i have mentioned all the other computer names/IPs. Now how can i keep other computer names in a separate text file and iterate them in batch file instead writing xcopy
command many times? Or is it possible to mention list of computers, iterate through all and use single xcopy command?
Try this:
FOR /F "delims=" %%i IN (targets.txt) DO (
xcopy "D:\some.txt" "%%i"
)
targets.txt should contain entries like "\\10.124.66.72\texts" in each line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With