@echo off
cls
echo Date format = %date%
echo dd = %date:~0,2%
echo mm = %date:~3,2%
echo yyyy = %date:~6,4%
echo.
echo Time format = %time%
echo hh = %time:~0,2%
echo mm = %time:~3,2%
echo ss = %time:~6,2%
echo.
set timestamp=%date:~6,4%-%date:~3,2%-%date:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%
F:\XAMPP\mysql\bin\mysqldump.exe -u root -pABC123 database >"C:\Users\Administrator\Desktop\backups\database_file_%timestamp%.sql"
The bat file breaks when I add the timestamp variable. I have tried a few different things but I am unsure why adding the timestamp variable would break it.