文件备份代码:别人写的搬来试用了下可以。

@echo off&setlocal enabledelayedexpansion 

set "xing=C:\update_log.txt"

echo a|xcopy "E:\IT管理" "E:\backup" /cfskrh>han.ye 2>&1

for /f "tokens=1* delims=>" %%a in (han.ye) do call:han "%%a" "%%b"

if "%gu%"=="" >>%xing% echo 恭喜你,本机已经在“%date% %time%”更新了所有文件

del /q han.ye

exit

:han

set han=%~1

if "%han:~0,3%"=="改写 " goto:ye

if "%han:~0,3%"=="复制了" goto:ye

(if "%han:~0,3%"=="共享侵" (

    if "!gu!"=="" echo 有以下文件因被本地程序占用未成功更新(%date% %time%):

    echo !ye:~1!

    set gu==

))>>%xing%

:ye

set ye=%~2