1

I am using mysqldump to backup mysql database. Now I just need to use the current date and time as file name for the generated sql file. How do I do that if my current code looks like this:

mysqldump -u root -p --add-drop-table --create-options --password= onstor >c:\sql.sql

I also found this code from this site, but I do not know how to incorporate it in my current code:

@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
echo %mydate%_%mytime%

Please help, thanks:)

Wern Ancheta
  • 18,841
  • 37
  • 93
  • 134

1 Answers1

1

This will solve your problem click here

Community
  • 1
  • 1
Rupeshit
  • 1,428
  • 1
  • 12
  • 23