test.bat
保存到 E:\duanwenxue 目录下,双击运行。- @echo off
- PowerShell "dir -Literal '%~dp0' -Filter *.txt -Recurse|group DirectoryName|%%{$name=$_.Name -replace '.*\\([^\\]+)$','$1.Log';$arr=$_.Group|%%{$m=[IO.File]::ReadAllText($_.FullName,[Text.Encoding]::Default) -match '(?<=>文章内容)[\s\S]*(?=短文学微信号:duanwenxuewang)';If($m){$matches[0]}};sc -Literal ('%~dp0'+$name) -Value $arr}"
- pause
复制代码
|