if %time:~0,2% LSS 10 (set hh=0%time:~1,1%) else (set hh=%time:~0,2%) ::上句是对某些系统的小时数的补零,条件或者写成`if "%time:~0,2%" lss "10"`。(上行中,辅助变量的语句不能有空格,如`set hh = "a"`将无法赋值。) set file_ts=%date:~2,2%%date:~5,2%%date:~8,2%_%hh%%time:~3,2%-01