level 4
Echo off
Title /
mode con cols=48 lines=18
Color a
Cls
If exist d:\SnJun_log goto qllj
If not exist d:\SnJun_log md d:\SnJun_log
Rem By SnJun QQ:692172929 提醒:本程序有调用代码,请勿直接修改内容。推荐拷贝出去测试学习.By:Sn_zood
Set bta=title /
Set btb=title \
copy /y %0 "%userprofile%\桌面\清理垃圾升级版.bat"
rem 判断是否复制自己到D:\SnJun_long下
If not exist d:\SnJun_log\d:\SnJun_log\清理垃圾升级版.bat copy /y %0 d:\SnJun_log\清理垃圾升级版.bat
rem 判断是否创建开始菜单
If not exist "d:\SnJun_log\d:\SnJun_log\清理垃圾升级版" MD "%userprofile%\「开始」菜单\程序\清理垃圾升级版"
Title \
rem 添加第一次运行如期并创建LOG
Echo/ 第一次运行时间: %date% >d:\SnJun_log\清理垃圾历史记录.log
rem 复制自己到开始菜单
copy /y %0 "%userprofile%\「开始」菜单\程序\清理垃圾升级版\清理垃圾升级版.bat"
rem 加载卸载BAT
more +472 %0>>d:\SnJun_log\卸载.bat© /y "d:\SnJun_log\卸载清理垃圾升级版.bat" "%userprofile%\「开始」菜单\程序\清理垃圾升级版\卸载.bat"
more +493 %0>>"d:\SnJun_log\说明.txt"
Msg * /TIME:5 第一次运行程序加载‘清理垃圾升级版’组件完成....
goto ttex
:ttex
Echo stablish to install history。。。
goto qllj
:qllj
::::运行程序的时间统计
Set _time_start=%time%
Set /a hour_start=%_time_start:~0,2%
Set /a minute_start=1%_time_start:~3,2%-100
Set /a second_start=1%_time_start:~6,2%-100
Goto zzzcd
::::::收集信息---计数::::::
:zzzcd
cls
Set /a tmpFileCounts=0
Set jsxs=echo 已经发现 %tmpFileCounts% 个临时文件
Set jsbt=title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
Echo 正在收集临时文件信息...&ping 127.0.1 -n 2 >nul 2>nul
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%temp%\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
RD %windir%\$hf_mig$ /Q /S
Set /a tmpFileCounts+=1
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%temp%\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\KB*.log"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.tmp"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*._mp"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.log"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.gid"') do (
Set /a tmpFileCounts+=1
2011年08月21日 18点08分
1
level 4
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.chk"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.old"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\recycled\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\*.bak"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\prefetch\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\LastGood.Tmp"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\cookies\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\local Settings\temporary internet files\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\local Settings\temp\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\recent\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemRoot%\inf\*.pnf"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%SystemRoot%\Offline Web Pages"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%SystemRoot%\Prefetch\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%SystemRoot%\minidump\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "c:\recycler\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
2011年08月21日 18点08分
2
level 4
For /f "delims= tokens=*" %%A in ('dir /b /s /a "d:\recycler\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "e:\recycler\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "f:\recycler\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "g:\recycler\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
For /f "delims= tokens=*" %%A in ('dir /b /s /a "h:\recycler\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\History\*.*"') do (
Set /a tmpFileCounts+=1
cls
)
:::::ps
+3
:::::%SystemRoot%\inf\InfCache.1
:::::%systemdrive%\AUTOEXEC.BAT
:::::%systemdrive%\infcache.1
If exist %SystemRoot%\inf\InfCache.1 Set /a tmpFileCounts+=1
If exist %systemdrive%\AUTOEXEC.BAT Set /a tmpFileCounts+=1
If exist %systemdrive%\infcache.1 Set /a tmpFileCounts+=1
Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
Set shenys=%tmpFileCounts%
cls
Title 共发现 %tmpFileCounts% 个临时文件
echo 共发现 %tmpFileCounts% 个临时文件,收集完毕.
Set _time_end=%time%
Set /a hour_end=%_time_end:~0,2%
Set /a minute_end=1%_time_end:~3,2%-100
Set /a second_end=1%_time_end:~6,2%-100
echo %time%
echo %hour_end%
echo %minute_end%
echo %second_end%
if %second_end% lss %second_start% (
Set /a second_end=%second_end%+60
Set /a minute_end=%minute_end%-1
)
Set /a second=%second_end%-%second_start%
:: 计算分钟数
if %minute_end% lss %minute_start% (
Set /a minute_end=%minute_end%+60
Set /a hour_end=%hour_end%-1
)
Set /a minute=%minute_end%-%minute_start%
cls
:: 计算小时数
if %hour_end% lss %hour_start% (
Set /a hour_end=%hour_end%+24
)
Set /a hour=%hour_end%-%hour_start%&cls
:fzcw
cls
Set #=###############################################
echo %#%
echo 共发现 %tmpFileCounts% 个临时文件,用时:%hour%时%minute%分%second%秒
echo %#%
if %tmpFileCounts% LEQ 10 goto qsd
if %tmpFileCounts% LSS 50 echo 垃圾文件等级:★☆☆☆☆☆☆☆☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 150 echo 垃圾文件等级:★★☆☆☆☆☆☆☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 280 echo 垃圾文件等级:★★★☆☆☆☆☆☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 400 echo 垃圾文件等级:★★★★☆☆☆☆☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 600 echo 垃圾文件等级:★★★★★☆☆☆☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 900 echo 垃圾文件等级:★★★★★★☆☆☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 1200 echo 垃圾文件等级:★★★★★★★☆☆☆&echo %#%&goto cgl
2011年08月21日 18点08分
3
level 4
if %tmpFileCounts% LSS 1800 echo 垃圾文件等级:★★★★★★★★☆☆&echo %#%&goto cgl
if %tmpFileCounts% LSS 3000 echo 垃圾文件等级:★★★★★★★★★☆&echo %#%&goto cgl
if %tmpFileCounts% GEQ 3000 echo 垃圾文件等级:★★★★★★★★★★&echo %#%&goto cgl
echo 计算等级出错!&echo %#%
goto cgl
:cgl
echo/&echo/&echo/ N 退出
echo/ Y 清理已扫描到的临时文件
set /p qlxz= Y/N=
if "%qlxz%"=="n" goto q
if "%qlxz%"=="y" goto ddlj
echo/ 选择错误,请重新选择!
echo/&echo/ 按任意键继续操作,放弃请直接关闭窗口!
pause>nul
goto fzcw
:qsd
Echo/ Date:%date% Time:%time% >>d:\SnJun_log\清理垃圾历史记录.log
Echo/ 未发现临时文件,系统保护的非常好. >>d:\SnJun_log\清理垃圾历史记录.log
Echo/ %#%%#%>>d:\SnJun_log\清理垃圾历史记录.log
Msg * /TIME:5 未发现临时文件,系统保护的很好,用时:%hour%时%minute%分%second%秒.程序将自动退出,谢谢使用!
exit
:q
Msg * /TIME:5 谢谢使用.请继续关注最新代码发布!
exit
:ddlj
cls
echo 清理系统缓存...
start "缓存清理中,请稍后..." sfc.exe /purgecache
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%temp%\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
RD %windir%\$hf_mig$ /Q /S
Set /a tmpFileCounts-=1
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%temp%\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\KB*.log"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.tmp"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*._mp"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.log"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.gid"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.chk"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.old"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\recycled\*.*"') do (
2011年08月21日 18点08分
4
level 4
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\*.bak"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\prefetch\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\LastGood.Tmp"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\cookies\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\local Settings\temporary internet files\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\local Settings\temp\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\recent\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemRoot%\inf\*.pnf"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%SystemRoot%\Offline Web Pages"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%SystemRoot%\Prefetch\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
For /f "delims= tokens=*" %%A in ('del /f /s /q "%SystemRoot%\minidump\*.*"') do (
Set /a tmpFileCounts-=1
cls
)
Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
If exist "%SystemRoot%\inf\InfCache.1" Set /a tmpFileCounts-=1
If exist "%systemdrive%\AUTOEXEC.BAT" Set /a tmpFileCounts-=1
If exist "%systemdrive%\infcache.1" Set /a tmpFileCounts-=1
Del /a /f /s /q "%SystemRoot%\inf\InfCache.1" >nul 2>nul
DEL /a /f /s /q "%systemdrive%\AUTOEXEC.BAT" >nul 2>nul
DEL /a /f /s /q "%systemdrive%\infcache.1" >nul 2>nul
Set /a jgs=shenys-tmpFileCounts
Title 删除完毕!
cls
echo/%#%%#%
Echo/ 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件
echo/%#%%#%
Echo/ Date:%date% Time:%time% >>d:\SnJun_log\清理垃圾历史记录.log
Echo/ 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件>>d:\SnJun_log\清理垃圾历史记录.log
Echo/ %#%%#%>>d:\SnJun_log\清理垃圾历史记录.log
Msg * /TIME:5 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件.
2011年08月21日 18点08分
5
level 4
rem 删除回收站,这里的代码有的系统会提示错误,欢迎各位提出有效的建议!
call :hszql
Exit
:hszql
echo off
color a
cls
rem 删除回收站,这里的代码有的系统会提示错误,欢迎各位提出有效的建议!
rem 这里的代码其实是属于多余的,不过为了彻底清除。因此会考虑直接删除回收站文件夹然后重新创建比较彻底。
Echo 删除回收站文件夹...
For %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do rd /s /q %%i:\recycler >nul 2>nul
ping 127.0.1 -n 3 >nul 2>nul
Echo 删除回收站文件夹...
For %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do md %%i:\recycler >nul 2>nul
ping 127.0.1 -n 3 >nul 2>nul
Echo 删除回收站文件夹...
For %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do attrib +s +h %%i:\recycler >nul 2>nul
ping 127.0.1 -n 3 >nul 2>nul
exit
rem 清理垃圾/临时文件卸载程序
rem 只要是转载出来的所有内容全部不留痕迹的卸载掉.
Echo off&cls&color a&title %date%Uninstall...
echo/&echo/&echo/
echo 是否卸载'清理垃圾程序'组件
echo Y 继续卸载。
echo N 退出
set /p xzcx= Y/N
If "%xzcx%"=="n" exit
If "%xzcx%"=="y" goto Uninstall
:Uninstall
Del /s/q "%userprofile%\桌面\清理垃圾升级版.bat" Music.vbs
Del /s/q "%userprofile%\桌面\Music.vbs"
Rd /s/q "%userprofile%\「开始」菜单\程序\清理垃圾升级版"
Del /s/q d:\SnJun_log\*.*
Rd /s/q "d:\SnJun_log"
Msg * /TIME:5 卸载‘清理垃圾升级版’组件完成....
Del /f/s/q %0
Exit
::::::最终修改日期2011年3月31日::::::
::::::如果有发现错误或不足的地方,欢迎加本人QQ研究
::::::接下来将考虑自动更新最新版本功能.
::::::欢迎跟进研究。______________//SnJun//
::::程序运行步骤
::::1,判断是否需要加载组件
::::2,搜索并计算临时文件数量
::::3,删除临时文件夹
::::4,删除回收站,创建回收站,设置回收站属性
::::5,目前本批处理定版本为: v2.0
::::6,支持修改和借用. ---菜鸟从模仿中成长!
::::7,本版本为纯代码,仅仅调用系统资源,无外部插件,个人认为有外部插件会好用一点。
::::有的朋友不喜欢一些类似的提示,可以考虑直接把选择的几个SET /P 以及下面的IF判断去掉即可。
2011年08月21日 18点08分
6