- <# :
- cls&echo off&cd /d "%~dp0"&mode con lines=5000
- path %SYSTEMROOT%\System32\WindowsPowerShell\v1.0;%path%
- set "current=%cd%"
- powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0'|Out-String|Invoke-Expression"
- pause
- exit
- #>
- $current=($env:current).trimend('\');
- $enc=New-Object System.Text.UTF8Encoding $False;
- $folders=@(dir -literal $current -recurse|?{$_ -is [System.IO.DirectoryInfo]});
- for($i=0;$i -lt $folders.length;$i++){
- if($folders[$i].Name -eq 'juans'){
- write-host $folders[$i].FullName -ForegroundColor yellow;
- $arr=New-Object -TypeName System.Collections.ArrayList;
- $files=@(dir -literal $folders[$i].FullName|?{('.xhtml' -eq $_.Extension) -and ($_ -is [System.IO.FileInfo])});
- for($j=0;$j -lt $files.length;$j++){
- write-host $files[$j].Name;
- $text=[IO.File]::ReadAllText($files[$j].FullName, $enc);
- $m=[regex]::matches($text, '<span class="text_2"><span class="corr">(.+?)</span>');
- foreach($it in $m){
- [void]$arr.add($it.groups[1].value);
- }
- }
- $newfile=$folders[$i].FullName+'\Cbeta.txt';
- [IO.File]::WriteAllLines($newfile, $arr, $enc);
- }
- }
复制代码
|