Test.bat,编码为utf8 without BOM- @echo off
- setlocal enabledelayedexpansion
- chcp 65001
-
- for /f "delims=" %%i in ('dir /b *.srt') do (
- (for /f "delims=" %%j in ('findstr /n .* "%%i"') do (
- set "s=%%j"
- if "!s: --> =!" NEQ "!s!" (
- set "s=!s:*:=!"
- for /f "tokens=1-8 delims=:,-> " %%A in ("!s!") do (
- set /a T1 = "((1%%A - 100) * 3600 + (1%%B - 100) * 60 + (1%%C - 100)) * 1000 + 1%%D - 1000"
- set /a T2 = "((1%%E - 100) * 3600 + (1%%F - 100) * 60 + (1%%G - 100)) * 1000 + 1%%H - 1000"
- set /a x = T2 - T1
- if !x! GTR 5000 (
- set /a T2 = T1 + 5000, ms = T2 %% 1000 + 1000, T2 /= 1000
- set /a HH = T2 /3600 + 100, mm = T2 %% 3600 / 60 + 100, ss = T2 %% 60 + 100
- set "s=%%A:%%B:%%C,%%D --> !HH:~1!:!mm:~1!:!ss:~1!,!ms:~1!"
- )
- )
- ) else (
- set "s=!s:*:=!"
- )
- echo;!s!
- )) > "%%i.~tmp"
- move "%%i.~tmp" "%%i"
- )
- pause
复制代码
|