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%
set mysqldumpPath="c:\mysql-5.7.22-winx64\bin\mysqldump.exe"
set dbName=test
set dbTable=test1
set dbUser=roottest
set dbPwd=roottest
set outpurDir=c:\b\db\backup\
set outputFileName=%outpurDir%%dbName%%dbTable%_%filename%.sql
echo %outputFileName%
%mysqldumpPath% -u%dbUser% -p%dbPwd% --opt --default-character-set=utf8 -e --triggers -R --hex-blob --flush-logs -x %dbName% %dbTable% > %outputFileName%
windows中常用来添加定时任务的命令
每天下午14:58:00执行test.bat脚本
C:\Users\DELL>schtasks /create /tn doc /tr C:\Users\DELL\Desktop\test.bat /sc DAILY /st 14:58:00
成功: 成功创建计划任务 "doc"。
解释下这条命令:
查询所有的定时任务
schtasks /query
查询指定的定时任务,通过findstr查找对应的任务名称