@echo off
::backup the sqlserver db
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump" --opt -uroot -pyuxun@80 dn2 > e:\mybackup\data%date:~0,10%"\%date:~0,10%_dn2.sql
"c:\Program Files\WinRAR\Rar.exe" a -k -r -s -m1 e:\mybackup\data%date:~0,10%.rar e:\mybackup\data%date:~0,10%
::pasue
::wait press any key to continue
::ready to delete
:: transfer the file to server via ftp
echo open 192.168.x.22>e:\ftp.txt
echo user backup>>e:\ftp.txt #用户
echo **>>e:\ftp.txt #密码
echo bin>>e:\ftp.txt #二进制
echo cd hy>>e:\ftp.txt #服务端目录
echo put e:\mybackup\data%date:~0,10%.rar>>e:\ftp.txt
echo bye>>e:\ftp.txt
ftp -n -s:e:\ftp.txt
::pause
::clean the tmp files
del e:\ftp.txt
del e:\data%date:~0,10%.rar
::backup the sqlserver db
md "e:\mybackup\data%date:~0,10%"
net stop MSSQLserver
copy D:\ap.web\data e:\mybackup\data%date:~0,10%
net start MSSQLserver
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump" --opt -uroot -pyuxun@80 dn2 > e:\mybackup\data%date:~0,10%"\%date:~0,10%_dn2.sql
"c:\Program Files\WinRAR\Rar.exe" a -k -r -s -m1 e:\mybackup\data%date:~0,10%.rar e:\mybackup\data%date:~0,10%
::pasue
::wait press any key to continue
::ready to delete
:: transfer the file to server via ftp
echo open 192.168.x.22>e:\ftp.txt
echo user backup>>e:\ftp.txt #用户
echo **>>e:\ftp.txt #密码
echo bin>>e:\ftp.txt #二进制
echo cd hy>>e:\ftp.txt #服务端目录
echo put e:\mybackup\data%date:~0,10%.rar>>e:\ftp.txt
echo bye>>e:\ftp.txt
ftp -n -s:e:\ftp.txt
::pause
::clean the tmp files
del e:\ftp.txt
del e:\data%date:~0,10%.rar