I am unix man, and I really don't like work on windows. I am asking You for help.
I am trying to make regular backups of mysql database in microsoft windows cmd. Here is my current script for that:
C:\xampp\mysql\mysqldump.exe -hlocalhost -uroot -ppass stp > V:\backup_126.96.36.199__%date:/=%.sql
I would like to file name have structure like that:
So I just need to add current time to file name.
Best How To :
You can not have
: as a part of the file name on Windows. Try the following batch file, it will create file with the name in the format such as:
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
"C:\xampp\mysql\mysqldump.exe" -hlocalhost -uroot -ppass svp > "V:\backup_188.8.131.52__%datetime%.sql"
I have used wmic example from the answer at: http://stackoverflow.com/a/18024049/4947851