同步网络文件批处理

 1 @echo off
 2 pushd "%~dp0"
 3 title %~n0 (Running)
 4 color 3f
 5 
 6 set src=\192.168.0.10path	ogo
 7 set dst=.
 8 set logfile="%~n0.log"
 9 set haserr=0
10 
11 echo * Creating log file: %logfile%
12 echo %DATE% %TIME%> %logfile%
13 echo * Result: %ERRORLEVEL%
14 call :copying "Bin"
15 call :copying "Config"
16 
17 goto :END
18 
19 :copying
20 echo.
21 echo * Copying %1 ...
22 robocopy "%src%\%~1" "%dst%\%~1" /MIR /Z /LOG+:%logfile% > nul
23 if ERRORLEVEL 8 (
24     set haserr=1
25     color 4f
26 )
27 echo * Result: %ERRORLEVEL%
28 goto :eof
29 
30 :END
31 title %~n0 (Completed)
32 if %haserr% equ 0 color 2f
33 echo.
34 echo Press any key to EXIT...
35 pause > nul
36 title %ComSpec%
37 color
38 popd
原文地址:https://www.cnblogs.com/Bob-wei/p/9641956.html