查看根目录树内 2008年3月份 ... ... 的exe文件:
创建的:cd\&dir/a/s/tc/4 *.exe|sort|findstr /b "2008-03"
写入的
注意日期中间是两个空格)
cd\&dir/a/s/tw/4 *.exe|sort|findstr /bc:"2008-03-01 20:10"
访问的:cd\&dir/a/s/ta/4 *.exe|sort|findstr /b "2008-03-01"
查看c:盘内 2008年3月1日到3月6日访问的exe文件:dir/a/s/ta/4 c:\*.exe|findstr /b "2008-03-0[1-6]"|sort
查看当天访问的所有文件.
for /f "skip=1" %a in ('wmic logicaldisk where "drivetype=3"') do echo %a------------------&dir/a/ta/s %a\|findstr /b "%date:~,10%"|sort|findstr /ve \.
@echo off
set http=http://www.cn-dos.net/forum/viewthread.php?tid=38096
if "%1"=="/?" goto help
if "%1"=="/c" goto code
if "%1"=="/a" goto all
if "%3"=="" (set t3=%date:~5,5%) else set t3=%3
dir/a/s%1/4 %2|findstr /b "2008-%t3%"|findstr /ve \.|sort
goto :eof
:help
echo -------------------------
echo /c 看源代码
echo /a 全盘的,必须作为第一个参数
echo /ta 访问
echo /tw 修改
echo /tc 创建
echo 例:
echo 查找C盘当天所有 访问的 后缀名exe的文件
echo %~n0 /ta c:\*.exe
echo 查看当天全盘访问的所有文件
echo %~n0 /a /ta *.*(*.*可以省略)
echo 查找当前目录树下2008年3月1号到9号所有 修改的 文件名与*.??匹配的 文件
echo %~n0 /tw *.?? 03-0[1-9]
echo 详细匹配见findstr /r参数.&echo 欢迎修改查询,并来%http%跟帖.
goto :eof
:all
shift
if "%3"=="" (set t3=%date:~5,5%) else set t3=%3
for /f "skip=1" %%a in ('wmic logicaldisk where "drivetype=3"') do (
echo %%a------------------
dir/a/s%1/4 %%a\%2|findstr /b "2008-%t3%"|sort|findstr /ve \.
)
goto :eof
:code
more %~f0
ping /n 2 127.0>nul
start/max %http%&goto :eof
PS: 用sort是为了按时间先后顺序排序,不在乎时间顺序可以省略.
[
Last edited by plp626 on 2008-3-6 at 11:41 AM ]