¿Alguien puede explicarme este script de respaldo?

I have a batch file for making a backup of my mysqldump, this works. But I don't understand the code. can someone, explain this to me.

for /f "tokens=1" %%i in ('date /t') do set DATE_DOW=%%i

for /f "tokens=2" %%i in ('date /t') do set DATE_DAY=%%i

for /f %%i in ('echo %date_day:/=-%') do set DATE_DAY=%%i
for /f %%i in ('time /t') do set DATE_TIME=%%i
for /f %%i in ('echo %date_time::=-%') do set DATE_TIME=%%i

:: here i make my backup 
"C:\Program Files\xampp\mysql\bin\mysqldump" -u root mamzel > "C:\Program Files\xampp\mysql\bin\%DATE_DAY%_%DATE_TIME%_mamzel10.sql"
at /delete /yes

at 09:00 /every:maandag,woensdag,donderdag d:\mysqlBackup.bat

Gracias de antemano!

preguntado el 01 de febrero de 12 a las 13:02

Think you should mark @Mechaflash's answer. -

I searched a lot for this code. Thanks. -

1 Respuestas

for /f "tokens=1" %%i in ('date /t') do set DATE_DOW=%%i
for /f "tokens=2" %%i in ('date /t') do set DATE_DAY=%%i

If in the U.S. time format, date /t outputs the date as Wed 02/01/2012 A token (without delims specified) will separate that output using spaces as the delimiting factor. So token 1=Wed and token 2=02/01/2012. Entonces estas asignando DATE_DOW=Wed y DATE_DAY=02/01/2012. Seeing as the days aren't in English, it's probably formated as year/month/day.

for /f %%i in ('echo %date_day:/=-%') do set DATE_DAY=%%i

Esto quita el / from the date and replacing it with -, so your output is 02-01-2012 en contraposición a 02/01/2012

for /f %%i in ('time /t') do set DATE_TIME=%%i
for /f %%i in ('echo %date_time::=-%') do set DATE_TIME=%%i

This does the same thing as the first part, except its grabbing the time format. The second line replaces the colons : con guiones -.

"C:\Program Files\xampp\mysql\bin\mysqldump" -u root mamzel > "C:\Program Files\xampp\mysql\bin\%DATE_DAY%_%DATE_TIME%_mamzel10.sql"

This then uses your new date and time formats to dump it to a timestamped dump file.

Respondido 01 Feb 12, 18:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.