首先建立 Srt_time_one.bat 批处理文件, 用来调整 srt 字幕文件的总体时间,提前或滞后。
@echo off
title Srt_time_one_num
CLS
color 2
if "%~2" equ "" echo 错误: 应为 Srt_time_one.bat ^"test.srt^" 2 这样的格式&pause>nul&exit /b
set "inFile=%1"
set "inFile=%inFile:"=%"
set /a "t=%2"
for /f "delims=0123456789-" %%a in ("%t%") do if not "%%a"=="" echo 错误: 秒数&pause>nul&exit /b
echo "%inFile%"
if not EXIST "%inFile%" echo 文件 "%inFile%" 不存在&pause>nul&exit /b
type nul >"%inFile%__tmp.srt"
setlocal enabledelayedexpansion
for /f "usebackq delims=" %%a in ("%inFile%") do (
set "str=%%a"
set "tmp=!str:~25,1!"
if defined tmp (
if /i "!tmp!"=="," (
set "bhms=!str:~17!"
echo !bhms! | findstr /i "^[0-9]*:[0-9]*:[0-9]*,[0-9]*" >nul&& (
set "ahms=!str:~0,8!"
set "astr=!str:~8,4!"
set /a "h1=1!ahms:~0,2!-100"
set /a "m1=1!ahms:~3,2!-100"
set /a "s1=1!ahms:~6,2!-100"
set /a "ts=!h1!*3600+!m1!*60+!s1!+!t!"
set /a "h1=!ts!/3600