@echo off
set /a tm1=%time:~0,2%*1
if %tm1% LSS 10 set tm1=0%tm1%
echo %date:~0,4%%date:~5,2%%date:~8,2%%tm1%%tm2%%tm3%%time:~3,2%%time:~6,2%
pause
结果:
20120710191105
set d=%date:~,10%
set d=%d:-=%
set t=0%time:~,8%
set t=%t: =%
set t=%t::=%
echo %d%%t%