powershell- <# :
- @echo off
- powershell -noprofile -NoLogo "iex (${%~f0} | out-string)"
- pause
- exit
- #>
- $re = "^\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}$"
- $n = 30
- [IO.Directory]::EnumerateFiles($pwd, "*.srt")|%{ [IO.File]::WriteAllLines("$_._new.txt",([IO.File]::ReadAllLines($_)|%{if($_ -match $re){$_ }else{$_ -split "(?<=\G.{$n})(?=.)"}}),[Text.Encoding]::UTF8)}
复制代码
|