I would like to make an automated task by using a .bat file in order to copy some files from the server to users' computers. The destination of the files can be on different partitions but the location (folder-wise) is the same.
For example I have 1 file I want to copy from the server to C:\Program Files\Program
or D:\Program Files\Program
(note that the path, apart from the partition is the same)
Something like this should work if you're running it from the server with admin rights.
@echo off
setlocal
for %%a in (computer1 computer2 computer3) do (
for %%b in (c d) do (
if exist "\\%%a\%%b$\Program Files\Program\." (
xcopy /F /I "yourfile.ext" "\\%%a\%%b$\Program Files\Program"
)
)
)
If you're running it from a workstation, you could do something like this:
@echo off
setlocal
for %%a in (c d) do (
if exist "%%a:\Program Files\Program\." (
xcopy /F /I "\\Server\Share\yourfile.ext" "%%a:\Program Files\Program"
)
)