- @echo off & setlocal enabledelayedexpansion
- rem Last modified at 2011-1-10 23:32
- rem abc def ghi jkl mno pqr stu vw xyz
-
- ::======参数设定======::
- set Ver=Ver 1.01
- set DAY=3
- set Detail=true
- set OUTPUT=%~dp0提取缓存文件\
- set RegCache="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
- set List1=视频:500000:*.FLV,*.F4V,*.HLV,*.WMV,*.MOV,*.MP4,*.MPG,*.M4V,*.AVI,*.RM*,*.ASF
- set List2=音频:300000:*.WAV,*.MP3,*.M4A,*.MID,*.WMA,*.RA,*.OGG,*.AAC,*.AMR,*.APE,*.CUE
- set List3=压缩:50000:*.RAR,*.ZIP,*.r0?,*.GZ,*.JAR,*.Z,*.7Z
- set List4=图片:50000:*.BMP,*.JPG,*.JPEG,*.GIF,*.PNG
-
- ::======工具题头======::
- :head
- cls
- echo =============^| IE缓存文件提取工具 %Ver% ^|=============
- echo.
- echo Supported by spark12 QQ:43218369
- echo.
- if "%1"=="R" goto :EOF
-
- ::====手工参数输入====::
- :main
- echo 说明:
- echo 使用本工具可以从IE缓存文件夹中提取缓存文件,请输入
- echo 要提取的文件类型:
- echo.
- echo.
- echo (注意:新的提取会覆盖老的提取,如有必要请先将旧文件
- echo 另存。输入 Q 退出程序)
- echo.
- set slist=
- for /l %%c in (1,1,10) do (
- if defined List%%c (
- for /f "tokens=1-3 delims=:" %%m in ("!List%%c!") do (
- echo [%%c]: %%m文件
- set slist=!slist!%%c,
- )
- )
- )
- echo.
- set /p swich=请输入选择编号 [%slist:~0,-1%]?
- set swich=%swich: =%
- if /i "%swich%"=="Q" exit
- if not defined List%swich% cls&echo &call:head R&goto main
- echo 已选择 %swich%
-
- :dnum
- call:head R
- echo.
- echo 程序可以只提取指定日期内生成的文件,在这里可以输入
- echo 天数,以决定提取天数范围,默认为 [%DAY%] 天,如果不想对时
- echo 间进行限制,请输入 [0].(例:输入 [1] 为只提取今天)
- echo.
- set /p DAY=请输入搜索天数[整数]:
- set DAY=%DAY: =%
- echo %DAY%|FINDSTR /R "^[0-9][0-9]*$" >nul 2>&1||echo &&goto dnum
- echo 已输入 %DAY%
-
- if not exist "%OUTPUT%" md "%OUTPUT%"
-
- ::获取IE缓存文件夹位置::
- for /f "tokens=1,* delims=Z" %%x in ('REG QUERY %RegCache% /v Cache^|find /I "Cache"') do (set IEcache=%%y)
- set IEcache=%IEcache:~1%
-
- ::==时间偏移计算模块==::
- for /f "tokens=1-3 delims=-:/ " %%a in ("%date%") do (
- set Y=%%a&set M=%%b&set D=%%c&if "!M:~0,1!"=="0" set M=!M:~1!
- if "!D:~0,1!"=="0" set D=!D:~1!
- )
- set/a D=D-%DAY%
- if !D! leq 0 (
- set/a M-=1&if !M!==0 set/a Y-=1,M=12
- set/a "T=^!(M-2)","R=(^!(Y%%4)&^!^!(Y%%100))|^!(Y%%400)","C=^!(M-4)|^!(M-6)|^!(M-9)|^!(M-11)","D=T*(28+R)+C*30+(^!T&^!C)*31"+D
- )
- set M=0%M%
- set D=0%D%
- set SDay=%Y%!M:~-2!!D:~-2!
-
- ::====文件提取模块===::
- :extract
- call:head R
- for /f "tokens=1-3 delims=:" %%m in ("!List%swich%!") do (
- set /a Lim=%%n/1024
- set Type=%%m
- set total=0
- if %DAY%==0 (
- echo 正在提取 [!Type!] 文件(不限时间, 大于!Lim!K以上)
- ) else (
- echo 正在提取 [!Type!] 文件(%DAY%天内, 大于!Lim!K以上)
- )
- echo.
- if exist "%OUTPUT%!Type!" (
- cd "%OUTPUT%!Type!"
- del /f /q %%o 2>nul && cd..
- ) else md "%OUTPUT%!Type!"
- set /a countNum=1
- set tp=000!countNum!
- for /r "%IEcache%" %%g in (%%o) do (
- set fileSize=%%~zg
- set swh=false
- if !fileSize! GEQ %%n (
- set fileDate=%%~tg
- set fileTime=!fileDate:~11!
- set fileTime=!fileTime::=-!
- set fileDate=!fileDate:~0,10!
- set fileDate=!fileDate:-=!
- set fileTime=!fileDate!_!fileTime!
- if "%DAY%"=="0" set swh=true
- if !fileDate! GTR %SDay% set swh=true
- if /i "!swh!"=="true" (
- set /a fLim=%%~zg/1024
- set /a total+=%%~zg
- set lastName=0000%%~ng
- set lastName=!lastName:~-7,4!
- if /i "%Detail%"=="true" echo COPY 文件:[%%~nxg] 大小:[!fLim! K]
- copy /y "%%g" "%OUTPUT%!Type!\!fileTime!_!lastName:[=0!!tp:~-4!%%~xg" >nul&&set /a countNum+=1
- set tp=000!countNum!
- )
- )
- )
- dir /b "%OUTPUT%!Type!"|findstr ".">nul||rd /q "%OUTPUT%!Type!"
- set /a countNum-=1
- set /a total/=1024
- )
-
- ::====执行结果模块===::
- :summary
- call:head R
- echo.
- if %countNum%==0 (
- echo 无可提取%Type%文件.
- ) else (
- echo 共成功提取 [%countNum%] 个%Type%文件(共%total%KB).
- echo 全部存入 [%OUTPUT%%Type%].
- )
- echo.
- set /p continue=是否继续提取其它文件(Y/N^)?:
- set continue=%continue: =%
- if /i not "%continue%"=="N" goto head
- dir /b "%OUTPUT%"|findstr ".">nul||cd..&rd /q "%OUTPUT%"
- echo 正在退出...
复制代码
[ 本帖最后由 spark12 于 2011-1-19 01:58 编辑 ] |