@echo off set abc=%date:~0,10%_%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2% md %abc% bat 按时间创建文件夹,如果是上午创建的文件夹,文件夹就会被分成2个 1个是2010-10-12_ 1个是7-12-53 10点钟以后创建的就正常了 2010-10-12_21-05-42
解决方法
::══代══码══开══始═══ @echo off set a=%date:~0,10%_ set b=%TIME:~0,2% if %TIME:~0,2% leq 9 (set b=0%TIME:~1,1%)else set b=%TIME:~0,2% set c=-%TIME:~3,2%-%TIME:~6,2% echo "%a%%b%%c%" md "%a%%b%%c%" pause ::══代══码══结══束═══