David Huby’s Blog Technical and business stuff

19Dec/080

Use the CALL command when nesting batch files

When nesting batch files, you must use the CALL command

first.bat

echo Begin first.bat

CALL second.bat

echo End first.bat 

If the "CALL" command is not used, "echo End first.bat" will never be executed.

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.