以下是windows下的批处理:
1set?hour_str=%time:~0,2%
2if?"%hour_str:~0,1%"=="?"?set?"hour_str=0%hour_str:~1%"
3set?fileName=%date:~0,4%-%date:~5,2%-%date:~8,2%_%hour_str%%time:~3,2%%time:~6,2%
4D:
5cd?D:\autobak\
6mysqldump?数据库名(改我)?-u?root?-p密码(改我)?>%fileName%.sql
7jar?cf?%fileName%.zip?%fileName%.sql
8del?%fileName%.sql