@echo off
set hour=%time:~0,2%
if "%time:~0,1%"==" " set hour=0%time:~1,1%
set now=%Date:~0,4%%Date:~5,2%%Date:~8,2%%hour%%Time:~3,2%%Time:~6,2%
echo %now%
set host=xxx.xxx.xxx.xxx
set port=3306
set user=root
set pass=root
set dbname=dataname
set backupfile=E:\backup\db\%dbname%-%now%.sql
E:\backup\mysql-5.7.13-winx64\bin\mysqldump -h%host% -P%port% -u%user% -p%pass% -c --add-drop-table %dbname% > %backupfile%
echo delete files before 60 days
forfiles /p "E:\backup\db" /m *.sql /d -60 /c "cmd /c del @file /f"