简体   繁体   中英

Copying files to remote desktops using batch file

I have 89 servers on which I am remotely connected that is I can access files of these system. There is one common folder or java application placed in all 89 desktops. We need to regularly update the folder whenever we have to make any changes in it which is now manual task ie we update each and every desktop manually.

Is there any mechanism through which we can update the folder in all 89 desktops at once and also we need the failure log if occurred for any desktop.

If your servers have some numerical name scheme, say SERVER_1 , SERVER_2 , ... then you can copy some file with:

@echo off
for /L %%a in (1,1,%lastnum%) do call :sp %%a
echo done!
goto :eof

:sp
set machine=SERVER_%1
copy c:\some\folder\somefile \\%machine%\C$\some\folder 
goto :eof

If you don't have a numerical naming scheme and instead a list of names, just gather these in a text file an replace by a FOR /F , iterating through each line and fetching the name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM