echo 取日期、时间变量值set yy=%date:~0,4% set mm=%date:~5,2% set dd=%date:~8,2% 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 date=%yy%%mm%%dd% set time=%hh%%mn%%ss% set filename=%date%_%time% "D:/install/dir/MySQL Server 5.5/bin/mysqldump.exe" -uroot -ppwd dbname > D:/xxx/filenamexxx%filename%.sql echo Completed #pause
以上内容保存为bat脚本,然后做windows任务计划程序添加任务即可。
标签:set,备份,Mysql,echo,2%,time,date,数据库 From: https://www.cnblogs.com/IBPM/p/17054985.html