I am trying to write a script to copy log files from different sources and PC´s to 1 destination using robocopy.
for /f "tokens=*" %%a in (pc.txt) do (
set source0="\\%%a\D$\log"
set source1="\\%%a\C$\XX\log"
set source2="\\%%a\C$\XXX\log"
set dest="\\%COMPUTERNAME%\C$\XXX\logscript\%%a"
robocopy %source0% %dest% /create
robocopy %source1% %dest%
robocopy %source2% %dest%
)
The problem I am facing is robocopy does not get the variables the at the first run, at the 2nd run its working but when i add more PC´s to my pc.txt it only uses some pc´s names.