I want to copy files from one folder to multiple pc in the local network.
I want to add IP address in array list like below
set list=\\192.168.55.102
set list=%list%;\\192.168.55.103
set list=%list%;\\192.168.55.104
set list=%list%;\\192.168.55.105
set list=%list%;\\192.168.55.106
then, I will copy file to above IP's by following code. But the following code will do for 1 ip. It's working and copied the file to destination location
net use "\\192.168.55.102\c$\foldername" /user:%username% %password%
:copy
copy "C:\Desktop\Update" "\\192.168.55.102\c$\foldername"
IF ERRORLEVEL 0 goto disconnect
goto end
:disconnect
net use "\\192.168.55.102\c$\foldername" /delete
goto end
:end
I tried like below, but it doesn't work
@echo off
for %a% in (%list%) do (
net use %a%\foldername /user:%username% %password%
:copy
copy "C:\Desktop\Update" %a%\foldername
IF ERRORLEVEL 0 goto disconnect
goto end
:disconnect
net use %a%\foldername /delete
goto end
:end
)