本帖最后由 foxJL 于 2013-9-27 15:32 编辑
回复 8# DAIC - @echo off >b.txt
- @echo off&setlocal enabledelayedexpansion
- for /f "skip=1 delims=" %%a in (a.txt) do (
- set /a n+=1
- if not defined str (
- for /f "tokens=1,2,4 delims=- " %%b in ("%%a") do set "str=%date:~,4%年%%b月%%c日 %%d"
- ) else (
- for /f "tokens=3,4 delims=: " %%b in ("%%a") do (
- set "_%%b%%c_!n!=!str! %%b:%%c"&set "str="
- set /a m+=1%%b %% 100,s+=1%%c %% 100
- if !s! gtr 60 set /a s-=60,m+=1
- if !m! gtr 60 set /a m-=60,h+=1
- )
- )
- )
- for /f "tokens=2 delims==" %%a in ('set _^|sort /r') do echo,%%a
- for %%a in (h m s) do set "%%a=00!%%a!"&set "%%a=!%%a:~-2!"
- echo,合计:%h%:%m%:%s% >>b.txt
- pause>nul
复制代码
|