日期:2014-05-17 浏览次数:20819 次
@echo off
set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,2%
set filename=fb_md_%year%%month%%day%.sql
mysqldump -uroot -ppassword test>f:\%filename%
pause
@echo off
:: ------- 配置项 -------
:: 要执行的文件名
set FILE=D:\db_backup.bat
:: 计划频率类型
set FREQUENCY=DAILY
:: 频率,与上面的计划频率类型对应
set MODIFIER=1
:: 该计划执行的时间(24 小时制)
set DATETIME=00:30:00
:: 计划的名字
set NAME="Backup Cron Job"
:: 计划执行用户,不建议修改
set USER="System"
:: ------- 以下请勿修改 -------
schtasks /Create /RU %USER% /SC %FREQUENCY% /MO %MODIFIER% /ST %DATETIME% /TN %NAME% /TR %FILE%
pause
@echo off
setlocal enabledelayedexpansion
set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,2%
echo %year%%month%%day%
if %day% LSS 07 (set/a lastweek_day=30+%day%-7 &echo !lastweek_day!&
set/a last_month=%month%-1 & set last_week=%year%!last_month!!
lastweek_day! &echo !last_week!) else (set/a lastweek_day=%day%-7 &
set last_month=%month% & set last_week=%year%!last_month!!
lastweek_day! &echo !last_week!)
pause