@echo off
::得到日期
set dateStr=%date:~0,10%
::得到时
set timeHour=%time:~0,2%
::得到分
set timeMin=%time:~3,2%
::得到秒
set timeSec=%time:~6,2%
::生成文件名
set dateTime="ydt%dateStr% %timeHour%%timeMin%%timeSec%"
cd D:\Program Files\mysql\backUP\ydt
D:
::调用7z压缩文件
"C:\Program Files\7-Zip\7z" a %dateTime% *.sql
del *.sql
::得到星期
%date:~-3%