批处理,自动备份文件。
@echo off
: Backup to bakFolder must be change youself
::[Edit][所要备份到的指定目录]
set baktagFolder="D:\backup"
: U want backups Folder must be change Youself
::[Edit][需要备份的文件]
set sorFolder="D:\电子说明书"
:set time to vir
set stry=%date:~0,4%&& set strm=%date:~5,2%&& set strd=%date:~8,2%
set strh=%time:~0,2%&& set strmin=%time:~3,2%
set strdatt=%stry%%strm%%strd%
set strlongdatt=%strdatt%%strh%%strmin%
::[Edit][改变文件名字命名规则]
: Backup to bakFolder by Date (year month day)& Time (hour min)
if not exist %baktagFolder% mkdir %baktagFolder%
if not exist %baktagFolder%\%strdatt% mkdir %baktagFolder%\%strdatt%
:: cd /d %sorFolder%
xcopy %sorFolder%\* /s/y %baktagFolder%\%strdatt%