第1个回答 2019-06-12
@echo off
set #=q&set/azx=0x53b7e0b4
title Any question +%#%%#% %zx%
cd /d "%~dp0"
powershell -NoProfile -ExecutionPolicy bypass ^
[System.Collections.ArrayList]$s=@();^
dir^|?{('.txt' -eq $_.Extension) -and ($_ -is [System.IO.FileInfo])}^|%%{^
write-host $_.Name;^
$text=[IO.File]::ReadAllText($_.FullName, [Text.Encoding]::Default);^
if($text -match '\[header\]([\s\S]+?)(?=\[data\]^|$)'){^
$item='['+$_.Name+']'+$matches[1].trim();^
[void]$s.Add($item);^
};^
};^
[IO.File]::WriteAllLines('total.log', $s, [Text.Encoding]::Default);
echo;Any question +%#%%#% %zx%
pause本回答被网友采纳