set mydate=%date:~10%%date:~4,2%%date:~7,2%
set mytime=%time:~0,2%%time:~3,2%%time:~6,2%
forfiles /P 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\' /S /M *.bak /D -7 /C "cmd /c del @PATH" // Delete all file less than 7 days
sqlcmd -S .\sqlexpress -Q "BACKUP DATABASE [YourDataBaseName] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\%mydate%_%mytime%.bak' WITH NOFORMAT, NOINIT, NAME = N'YourDataBaseName-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
Примечание: имя файла теперь равно дате и времени с использованием обеих переменных mydate и mytime