本帖最后由 flashercs 于 2025-1-3 15:35 编辑
- @echo off
- cd /d "%~dp0"
- @REM 文本1 此文件必须带有时间轴00:00:04,458 --> 00:00:05,291
- set "file1=1.srt"
- @REM 文本2
- set "file2=2.srt"
- powershell -c "$re=[regex]'(?im)^\d{2}:\d{2}:\d{2},\d{3}\s*-->\s*\d{2}:\d{2}:\d{2},\d{3}(?>\r?\n[^\r\n]+)+';$lines2=[IO.File]::ReadAllLines($env:file2);$script:ctr=0;[IO.File]::WriteAllText($env:file1,$re.Replace([IO.File]::ReadAllText($env:file1),{param($m)($m.Value,$lines2[$script:ctr++]) -join [Environment]::NewLine;}));"
- pause
复制代码
|