English environment:
echo Archive_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.zip
Chinese:
- echo generates the file name based on the current date time, ...
- Set yyyymmdd=%date:~0,4%%date:~5,2%%date:~8,2%
- Set hhmiss=%time:~0,2%%time:~3,2%%time:~6,2%
- Set "Filename=website3copy%yyyymmdd%_%hhmiss%.zip"
- Echo%filename%
How to remove spaces:
- C:\>set h=%time:~0,2%
- C:\>set h=%h: =0%
- < Span class= "Hljs-symbol" > c:\> echo%date:~0,4 %%date:~5,2%%date:~8,2%%h%%time:~3,< Span class= "Hljs-number" >2%%time:~6,2%
- 20150324090254
Reference Links: http://blog.csdn.net/chinadm123/article/details/44588891
http://blog.csdn.net/xuexiaodong009/article/details/53462592
Https://stackoverflow.com/questions/7727114/batch-command-date-and-time-in-file-name
My Backup Mantis script:
CD C:\Program files\mysql\mysql Server 5.6\bin
Set h=%time:~0,2%
Set H=%h: =0%
Set "Filename=mantis_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.sql"
Echo%filename%
MYSQLDUMP-UROOT-P3EDC$RFV bugtracker > \\172.16.10.240\Infa_Shared\Mantis\%filename%
Create a file name with a timestamp under Windows