bat不怎么会啊,研究好久才写了个能用的。
echo off set BAK_Dir=F:\share\JavaServer\224DB_BackUP ::yyyy-MM-dd-hhmmss for /f "tokens=1-4 delims=/:. " %%i in ("%date:~0,10%-%time%") do (
set ymd=%%i%%j%%k%%l
)
if not exist %BAK_Dir% md %BAK_Dir% cd /d C:\Program Files\MySQL\MySQL Server 5.5\bin\ mysqldump.exe -hlocalhost -uroot -proot --default-character-set=utf8 dbName>>%BAK_Dir%\%ymd%_dbName.sql pause