@echo off
@title Mysql+filebckup
Set Files=d:\backup\%date:~0,10%.rar
Set userdb= "Root"
Set pwddb= "123456"
Set filepath= "D:\wwwroot"
Set ftpfile= "C:\ftp.txt"
Set Ftpname=ftpuser
Set Ftppwd=ftpuser
Set ftpfiles= "%date:~0,10%.rar"
Set ftpdomian= "42.51.153.157"
Set rarpath= "C:\Program Files\winrar"
Set "ymd=%date:~,4%%date:~5,2%%date:~8,2%"
@echo Start Backup Mysql
MD "D:\BACKUP\%YMD%.MYSQ L"
"D:\phpStudy\MySQL\bin\mysqldump.exe"--opt-q-uroot-p123456--default-character-set=utf8 discuz > "D:\backup\% Ymd%.mysql\discuz.sql "
"D:\phpStudy\MySQL\bin\mysqldump.exe"--opt-q-uroot-p123456--default-character-set=utf8 dede > "D:\backup\%Ymd% . Mysql\dede.sql "
"D:\phpStudy\MySQL\bin\mysqldump.exe"--opt-q-u root-p123456--default-character-set=utf8 weixin > "D:\backup\% Ymd%.mysql\weixin.sql "
@echo Start compressing files
C:
CD C:\Program Files\winrar
RAR. EXE a-r-y%files%%ymd%%filespath% D:\wwwroot
@echo Writing to file ftp
@echo%ftpname%>%ftpfile%
@echo%ftppwd%>>%ftpfile%
@echo put%files%%ftpfiles%>>%ftpfile%
@echo bye>>%ftpfile%
@echo Upload%files%.rar file
Ftp-s:%ftpfile% 42.51.153.157
CD C:\Documents and settings\administrator\ desktop
Echo%date% Backup succeeded
Pause
C:\ftp.txt Content
Ftpuser
123456
Put D:\backup\%date:~0,10%.rar
Bye
Widnows Batch processing offsite backup data