不同的操作系统时间格式可能有差异,以Win7为例,其他情况可以自己修改,或采纳后联系我
echo nul>xxx%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%.txt
@echo off
set d=%date:-=%
set t=%time:~,5%
set t=%t::=%
type nul>%d%%t%
set "T=%time:~0,-3%"
set "D=%date:~0,-3%"
echo nul> xxx"%D%%T::=-%".txt
年月日时分秒都给你上了。