bat 文件:
/*********************************************************************/
echo
set backdir="E:\db_backup"
set dbname=dcms
set mysqlsetupdir="C:\Program Files\Mysql\mysql-5.7.14-winx64"
set rootPWD=Enlong123
echo forfiles /p %backdir% /m %dbname%_*.sql -d -10 /c "cmd /c del /f @path"
forfiles /p %backdir% /m %dbname%_*.sql -d -10 /c "cmd /c del /f @path"
if /i %time:~0,2% lss 10 set hh=0%time:~1,1%
if /i %time:~0,2% geq 10 set hh=%time:~0,2%
set mn=%time:~3,2%
set ss=%time:~6,2%
set time=%hh%%mn%%ss%
set "Ymd=%date:~0,4%%date:~5,2%%date:~8,2%%time%"
cd /d "%mysqlsetupdir%/bin"
mysqldump --opt -u root --password=%rootPWD% %dbname% > %backdir%/%dbname%_%Ymd%.sql
echo
/*********************************************************************/
windows设置自动任务
1、
2、
3、
4、
5、
6、
7、
8、
9、右键运行测试