昨天本想来抛个砖的,结果不能登陆。
脚本和文件夹放在同一目录
要求ps4.0以上,速度快些。- @echo off
- PowerShell -ExecutionPolicy Bypass -Command "dir \".\要查找的文件夹\*.txt\" -file |sort {$_.LastWriteTime}|?{(gc $_ -raw).contains('特定内容')}|select -first 1 -last 1"
- pause
复制代码 这个ps2.0以上,好像不支持xp版的PS2.0(要修改)- @echo off
- PowerShell -ExecutionPolicy Bypass -Command "dir \".\要查找的文件夹\*.txt\"|sort {$_.LastWriteTime}|?{((gc $_) -join \"`r`n\").contains('特定内容')}|select -first 1 -last 1"
- pause
复制代码
|