David Huby’s Blog Technical and business stuff

19Dec/081

Daily or Hourly MySQL database backups on the command line in Windows

for /f "tokens=2,3,4,5,6 delims=/: " %%a in ("%date% %time%") do set timestamp=%%c-%%b-%%a-%%d-%%e

mysqldump -u DatabaseUsername -pPassword TheDatabaseName > C:\Archive\TheDatabaseName-%timestamp%.sql

 

References: http://technet.microsoft.com/en-au/library/bb490909.aspx

This currently points to the "for" article under Command Line reference A-Z under Windows XP in technet. Of course, by the time you click on the link, the article will have moved to a different URL.