I'm able to schedule a windows task to create a MySQL database backup based on advice given in this stackoverflow question:
MySQL Database backup automatically on a windows server
This is my command:
mysqldump.exe --user=[user] --password=[password] --host=localhost --port=3306 --result-file="c:\data\backup.sql" --default-character-set=utf8 --single-transaction=TRUE --databases "[database1]"
However, when I change my filename to include a dynamic date value as follows it doesn't create a backup anymore:
mysqldump.exe --user=[user] --password=[password] --host=localhost --port=3306 --result-file="c:\data\backup%date:~10,4%%date:~7,2%%date:~4,2%.sql" --default-character-set=utf8 --single-transaction=TRUE --databases "[database1]"
Note: when I run this command via commandline it successfully creates a backup with the correct filename: backup.20160707.sql.
But for some reason when I run the Windows Task which runs this command it is not creating the backup file. When I look at history it appears to have finished successfully. What's going on?