本帖最后由 yakeyun 于 2022-4-28 20:54 编辑
回复 1# vicodin
来个纯P,效率比较慢,有兴趣的可以修改下,提下速:- @echo off&setlocal enabledelayedexpansion
- cd /d "%~dp0"
- (
- REM=========================================================
- for /f "tokens=1-3,*" %%a in (a.txt) do (
- for /f "tokens=1-2,* delims=:" %%e in ('echo %%a') do (
- for /f "tokens=1,* delims=." %%g in ('echo %%g') do (
- set AD=%%d
- set Ha=%%h
- set /a Ea=%%e * 60 * 60 * 1000
- set /a Fa=%%f * 60 * 1000
- set /a Ga=%%g * 1000
- set /a AA=!Ea!+!Fa!+!Ga!+!Ha!
- )
- )
- REM=========================================================
- for /f "tokens=1-2,* delims=:" %%e in ('echo %%b') do (
- for /f "tokens=1,* delims=." %%g in ('echo %%g') do (
- set Hb=%%h
- set /a Eb=%%e * 60 * 60 * 1000
- set /a Fb=%%f * 60 * 1000
- set /a Gb=%%g * 1000
- set /a AB=!Eb!+!Fb!+!Gb!+!Hb!
- )
- )
- REM=========================================================
- for /f "tokens=1-2,* delims=:" %%e in ('echo %%c') do (
- for /f "tokens=1,* delims=." %%g in ('echo %%g') do (
- set Hc=%%h
- set /a Ec=%%e * 60 * 60 * 1000
- set /a Fc=%%f * 60 * 1000
- set /a Gc=%%g * 1000
- set /a AC=!Ec!+!Fc!+!Gc!+!Hc!
- )
- )
- echo,!AA! !AB! !AC! !AD!
- )
- ) >new_a.txt
- echo.
- echo,数据处理完毕!!!
- echo.
- pause>nul
复制代码
|