本帖最后由 WHY 于 2018-12-13 16:30 编辑
回复 43# lxh623
zgshige.bat | @echo off | | echo %time% | | set "htmlPath=E:\zgshige" | | dir /b /s "%htmlPath%\*.html" > List.txt | | PowerShell -exec ByPass -f "zgshige.PS1" List.txt | | del List.txt | | echo %time% | | pauseCOPY |
zgshige.ps1 | param([String]$ListFile); | | $MyPath = $MyInvocation.MyCommand.Path -replace '[^\\]+$'; | | | | forEach ($file In (type $ListFile -ReadCount 0)) { | | $str = [IO.File]::ReadAllText($file, [Text.Encoding]::UTF8); | | $arr = $str -split '<div class="(?:text-center b-b b-2x b-lt|col-xs-12 hidden-sm[^"]*)">'; | | If ($arr.Count -eq 3) { | | $s = $arr[1] -replace '<h3>(?!TTT)', '$&TTT'; | | $s = $s -replace '(?<!\r)\n', "`r`n"; | | $s = $s -replace '<div class="(signature|m-lg font14|note)">|</?br>|<br/>|</p>', '<br />'; | | $s = $s -replace '<!--(?:(?!-->)[\s\S])*-->| '; | | $s = $s -replace '<(?!br|/?h3)[^>]*>'; | | $s = $s -replace '(<br />)+', '$1'; | | $s = $s -replace '(?m)^\s+'; | | $name = ($file -split '\\')[-2] + '.Log'; | | [IO.File]::AppendAllText($MyPath + $name, $s + "`r`n", [Text.Encoding]::UTF8); | | } | | }COPY |
|