本帖最后由 Nsqs 于 2023-11-21 07:14 编辑
- # 2>nul&cls&powershell -noprofile -executionpolicy bypass "gc '%~0'|out-string|iex"&exit
- function collect($a,$b){
- $s=[System.IO.File]::ReadAllLines($a,[System.Text.Encoding]::Default)|?{$_ -match '\w+'}
- $res=[System.Collections.Generic.stack[string]]@{}
- $fn={
- param($t,$c,$n,$x=1)
- if($n -lt $c){
- $m=$s[$n+1] -split ' --> '
- $res.Push(($m[0],$m[1],$x,$s[$n+2] -join ';'))
- $res.Pop();$fn.Invoke($t,$c,$n+3,$x+1)
- }
- }
- [System.IO.File]::WriteAllLines($b,$fn.Invoke($s,$s.length))
- }
- collect 1.srt 2.srt
复制代码
|