[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[系统相关] [分享]垃圾清理v3.5 小俊十二年升级四次 新代码在8楼

本帖最后由 qq692172929 于 2016-1-24 01:15 编辑
  1. Echo off
  2. Title /
  3. mode con cols=48 lines=18
  4. Color a
  5. Cls
  6. If exist d:\SnJun_log goto qllj
  7. If not exist d:\SnJun_log md d:\SnJun_log
  8. Rem By SnJun QQ:692172929  提醒:本程序有调用代码,请勿直接修改内容。推荐拷贝出去测试学
  9. 习.By:Sn_zood
  10. Set bta=title /
  11. Set btb=title \
  12. copy /y %0 "%userprofile%\桌面\清理垃圾升级版.bat"
  13. rem 判断是否复制自己到D:\SnJun_long下
  14. If not exist d:\SnJun_log\d:\SnJun_log\清理垃圾升级版.bat copy /y %0 d:\SnJun_log\清理垃圾升
  15. 级版.bat
  16. rem 判断是否创建开始菜单
  17. If not exist "d:\SnJun_log\d:\SnJun_log\清理垃圾升级版" MD "%userprofile%\「开始」菜单\程序\
  18. 清理垃圾升级版"
  19. Title \
  20. rem 添加第一次运行如期并创建LOG
  21. Echo/ 第一次运行时间: %date% >d:\SnJun_log\清理垃圾历史记录.log
  22. rem 复制自己到开始菜单
  23. copy /y %0 "%userprofile%\「开始」菜单\程序\清理垃圾升级版\清理垃圾升级版.bat"
  24. rem 加载卸载BAT
  25. more +472 %0>>d:\SnJun_log\卸载.bat&copy /y "d:\SnJun_log\卸载清理垃圾升级版.bat" "%
  26. userprofile%\「开始」菜单\程序\清理垃圾升级版\卸载.bat"
  27. more +493 %0>>"d:\SnJun_log\说明.txt"
  28. Msg * /TIME:5 第一次运行程序加载‘清理垃圾升级版’组件完成....
  29. goto ttex
  30. :ttex
  31. Echo stablish to install history。。。
  32. goto qllj
  33. :qllj
  34. ::::运行程序的时间统计
  35. Set _time_start=%time%
  36. Set /a hour_start=%_time_start:~0,2%
  37. Set /a minute_start=1%_time_start:~3,2%-100
  38. Set /a second_start=1%_time_start:~6,2%-100
  39. Goto zzzcd
  40. ::::::收集信息---计数::::::
  41. :zzzcd
  42. cls
  43. Set /a tmpFileCounts=0
  44. Set jsxs=echo  已经发现 %tmpFileCounts% 个临时文件
  45. Set jsbt=title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  46. Echo 正在收集临时文件信息...&ping 127.0.1 -n 2 >nul 2>nul
  47. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%temp%\*.*"') do (
  48. Set /a tmpFileCounts+=1
  49. cls
  50. )
  51. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  52. RD %windir%\$hf_mig$ /Q /S
  53. Set /a tmpFileCounts+=1
  54. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  55. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%temp%\*.*"') do (
  56. Set /a tmpFileCounts+=1
  57. cls
  58. )
  59. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  60. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\KB*.log"') do (
  61. Set /a tmpFileCounts+=1
  62. cls
  63. )
  64. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  65. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.tmp"') do (
  66. Set /a tmpFileCounts+=1
  67. cls
  68. )
  69. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  70. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*._mp"') do (
  71. Set /a tmpFileCounts+=1
  72. cls
  73. )
  74. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  75. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.log"') do (
  76. Set /a tmpFileCounts+=1
  77. cls
  78. )
  79. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  80. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.gid"') do (
  81. Set /a tmpFileCounts+=1
  82. cls
  83. )
  84. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  85. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.chk"') do (
  86. Set /a tmpFileCounts+=1
  87. cls
  88. )
  89. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  90. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\*.old"') do (
  91. Set /a tmpFileCounts+=1
  92. cls
  93. )
  94. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  95. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemdrive%\recycled\*.*"') do (
  96. Set /a tmpFileCounts+=1
  97. cls
  98. )
  99. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  100. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\*.bak"') do (
  101. Set /a tmpFileCounts+=1
  102. cls
  103. )
  104. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  105. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\prefetch\*.*"') do (
  106. Set /a tmpFileCounts+=1
  107. cls
  108. )
  109. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  110. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\LastGood.Tmp"') do (
  111. Set /a tmpFileCounts+=1
  112. cls
  113. )
  114. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  115. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\cookies\*.*"') do (
  116. Set /a tmpFileCounts+=1
  117. cls
  118. )
  119. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  120. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\local Settings\temporary
  121. internet files\*.*"') do (
  122. Set /a tmpFileCounts+=1
  123. cls
  124. )
  125. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  126. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\local Settings\temp\*.*"') do
  127. (
  128. Set /a tmpFileCounts+=1
  129. cls
  130. )
  131. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  132. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%userprofile%\recent\*.*"') do (
  133. Set /a tmpFileCounts+=1
  134. cls
  135. )
  136. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  137. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%systemRoot%\inf\*.pnf"') do (
  138. Set /a tmpFileCounts+=1
  139. cls
  140. )
  141. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  142. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%SystemRoot%\Offline Web Pages"') do (
  143. Set /a tmpFileCounts+=1
  144. cls
  145. )
  146. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  147. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%SystemRoot%\Prefetch\*.*"') do (
  148. Set /a tmpFileCounts+=1
  149. cls
  150. )
  151. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  152. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%SystemRoot%\minidump\*.*"') do (
  153. Set /a tmpFileCounts+=1
  154. cls
  155. )
  156. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  157. For /f "delims= tokens=*" %%A in ('dir /b /s /a "c:\recycler\*.*"') do (
  158. Set /a tmpFileCounts+=1
  159. cls
  160. )
  161. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  162. For /f "delims= tokens=*" %%A in ('dir /b /s /a "d:\recycler\*.*"') do (
  163. Set /a tmpFileCounts+=1
  164. cls
  165. )
  166. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  167. For /f "delims= tokens=*" %%A in ('dir /b /s /a "e:\recycler\*.*"') do (
  168. Set /a tmpFileCounts+=1
  169. cls
  170. )
  171. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  172. For /f "delims= tokens=*" %%A in ('dir /b /s /a "f:\recycler\*.*"') do (
  173. Set /a tmpFileCounts+=1
  174. cls
  175. )
  176. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  177. For /f "delims= tokens=*" %%A in ('dir /b /s /a "g:\recycler\*.*"') do (
  178. Set /a tmpFileCounts+=1
  179. cls
  180. )
  181. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  182. For /f "delims= tokens=*" %%A in ('dir /b /s /a "h:\recycler\*.*"') do (
  183. Set /a tmpFileCounts+=1
  184. cls
  185. )
  186. For /f "delims= tokens=*" %%A in ('dir /b /s /a "%windir%\History\*.*"') do (
  187. Set /a tmpFileCounts+=1
  188. cls
  189. )
  190. :::::ps+3
  191. :::::%SystemRoot%\inf\InfCache.1
  192. :::::%systemdrive%\AUTOEXEC.BAT
  193. :::::%systemdrive%\infcache.1
  194. If exist %SystemRoot%\inf\InfCache.1 Set /a tmpFileCounts+=1
  195. If exist %systemdrive%\AUTOEXEC.BAT Set /a tmpFileCounts+=1
  196. If exist %systemdrive%\infcache.1 Set /a tmpFileCounts+=1
  197. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  198. Set shenys=%tmpFileCounts%
  199. cls
  200. Title 共发现 %tmpFileCounts% 个临时文件
  201. echo 共发现 %tmpFileCounts% 个临时文件,收集完毕.
  202. Set _time_end=%time%
  203. Set /a hour_end=%_time_end:~0,2%
  204. Set /a minute_end=1%_time_end:~3,2%-100
  205. Set /a second_end=1%_time_end:~6,2%-100
  206. echo %time%
  207. echo %hour_end%
  208. echo %minute_end%
  209. echo %second_end%
  210. if %second_end% lss %second_start% (
  211.     Set /a second_end=%second_end%+60
  212.     Set /a minute_end=%minute_end%-1
  213. )
  214. Set /a second=%second_end%-%second_start%
  215. :: 计算分钟数
  216. if %minute_end% lss %minute_start% (
  217.     Set /a minute_end=%minute_end%+60
  218.     Set /a hour_end=%hour_end%-1
  219. )
  220. Set /a minute=%minute_end%-%minute_start%
  221. cls
  222. :: 计算小时数
  223. if %hour_end% lss %hour_start% (
  224.     Set /a hour_end=%hour_end%+24
  225. )
  226. Set /a hour=%hour_end%-%hour_start%&cls
  227. :fzcw
  228. cls
  229. Set #=###############################################
  230. echo %#%
  231. echo  共发现 %tmpFileCounts% 个临时文件,用时:%hour%时%minute%分%second%秒
  232. echo %#%
  233. if %tmpFileCounts% LEQ 10 goto qsd
  234. if %tmpFileCounts% LSS 50 echo 垃圾文件等级:★☆☆☆☆☆☆☆☆☆&echo %#%&goto cgl
  235. if %tmpFileCounts% LSS 150 echo 垃圾文件等级:★★☆☆☆☆☆☆☆☆&echo %#%&goto cgl
  236. if %tmpFileCounts% LSS 280 echo 垃圾文件等级:★★★☆☆☆☆☆☆☆&echo %#%&goto cgl
  237. if %tmpFileCounts% LSS 400 echo 垃圾文件等级:★★★★☆☆☆☆☆☆&echo %#%&goto cgl
  238. if %tmpFileCounts% LSS 600 echo 垃圾文件等级:★★★★★☆☆☆☆☆&echo %#%&goto cgl
  239. if %tmpFileCounts% LSS 900 echo 垃圾文件等级:★★★★★★☆☆☆☆&echo %#%&goto cgl
  240. if %tmpFileCounts% LSS 1200 echo 垃圾文件等级:★★★★★★★☆☆☆&echo %#%&goto cgl
  241. if %tmpFileCounts% LSS 1800 echo 垃圾文件等级:★★★★★★★★☆☆&echo %#%&goto cgl
  242. if %tmpFileCounts% LSS 3000 echo 垃圾文件等级:★★★★★★★★★☆&echo %#%&goto cgl
  243. if %tmpFileCounts% GEQ 3000 echo 垃圾文件等级:★★★★★★★★★★&echo %#%&goto cgl
  244. echo 计算等级出错!&echo %#%
  245. goto cgl
  246. :cgl
  247. echo/&echo/&echo/    N 退出
  248. echo/    Y 清理已扫描到的临时文件
  249. set /p qlxz=    Y/N=
  250. if "%qlxz%"=="n" goto q
  251. if "%qlxz%"=="y" goto ddlj
  252. echo/ 选择错误,请重新选择!
  253. echo/&echo/                          按任意键继续操作,放弃请直接关闭窗口!
  254. pause>nul
  255. goto fzcw
  256. :qsd
  257. Echo/ Date:%date%  Time:%time% >>d:\SnJun_log\清理垃圾历史记录.log
  258. Echo/ 未发现临时文件,系统保护的非常好. >>d:\SnJun_log\清理垃圾历史记录.log
  259. Echo/ %#%%#%>>d:\SnJun_log\清理垃圾历史记录.log
  260. Msg * /TIME:5 未发现临时文件,系统保护的很好,用时:%hour%时%minute%分%second%秒.程序将自动退出
  261. ,谢谢使用!
  262. exit
  263. :q
  264. Msg * /TIME:5 谢谢使用.请继续关注最新代码发布!
  265. exit
  266. :ddlj
  267. cls
  268. echo 清理系统缓存...
  269. start "缓存清理中,请稍后..." sfc.exe /purgecache
  270. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  271. For /f "delims= tokens=*" %%A in ('del /f /s /q "%temp%\*.*"') do (
  272. Set /a tmpFileCounts-=1
  273. cls
  274. )
  275. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  276. RD %windir%\$hf_mig$ /Q /S
  277. Set /a tmpFileCounts-=1
  278. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  279. For /f "delims= tokens=*" %%A in ('del /f /s /q "%temp%\*.*"') do (
  280. Set /a tmpFileCounts-=1
  281. cls
  282. )
  283. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  284. For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\KB*.log"') do (
  285. Set /a tmpFileCounts-=1
  286. cls
  287. )
  288. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  289. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.tmp"') do (
  290. Set /a tmpFileCounts-=1
  291. cls
  292. )
  293. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  294. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*._mp"') do (
  295. Set /a tmpFileCounts-=1
  296. cls
  297. )
  298. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  299. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.log"') do (
  300. Set /a tmpFileCounts-=1
  301. cls
  302. )
  303. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  304. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.gid"') do (
  305. Set /a tmpFileCounts-=1
  306. cls
  307. )
  308. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  309. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.chk"') do (
  310. Set /a tmpFileCounts-=1
  311. cls
  312. )
  313. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  314. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\*.old"') do (
  315. Set /a tmpFileCounts-=1
  316. cls
  317. )
  318. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  319. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemdrive%\recycled\*.*"') do (
  320. Set /a tmpFileCounts-=1
  321. cls
  322. )
  323. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  324. For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\*.bak"') do (
  325. Set /a tmpFileCounts-=1
  326. cls
  327. )
  328. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  329. For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\prefetch\*.*"') do (
  330. Set /a tmpFileCounts-=1
  331. cls
  332. )
  333. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  334. For /f "delims= tokens=*" %%A in ('del /f /s /q "%windir%\LastGood.Tmp"') do (
  335. Set /a tmpFileCounts-=1
  336. cls
  337. )
  338. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  339. For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\cookies\*.*"') do (
  340. Set /a tmpFileCounts-=1
  341. cls
  342. )
  343. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  344. For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\local Settings\temporary
  345. internet files\*.*"') do (
  346. Set /a tmpFileCounts-=1
  347. cls
  348. )
  349. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  350. For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\local Settings\temp\*.*"') do
  351. (
  352. Set /a tmpFileCounts-=1
  353. cls
  354. )
  355. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  356. For /f "delims= tokens=*" %%A in ('del /f /s /q "%userprofile%\recent\*.*"') do (
  357. Set /a tmpFileCounts-=1
  358. cls
  359. )
  360. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  361. For /f "delims= tokens=*" %%A in ('del /f /s /q "%systemRoot%\inf\*.pnf"') do (
  362. Set /a tmpFileCounts-=1
  363. cls
  364. )
  365. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  366. For /f "delims= tokens=*" %%A in ('del /f /s /q "%SystemRoot%\Offline Web Pages"') do (
  367. Set /a tmpFileCounts-=1
  368. cls
  369. )
  370. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  371. For /f "delims= tokens=*" %%A in ('del /f /s /q "%SystemRoot%\Prefetch\*.*"') do (
  372. Set /a tmpFileCounts-=1
  373. cls
  374. )
  375. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  376. For /f "delims= tokens=*" %%A in ('del /f /s /q "%SystemRoot%\minidump\*.*"') do (
  377. Set /a tmpFileCounts-=1
  378. cls
  379. )
  380. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  381. If exist "%SystemRoot%\inf\InfCache.1" Set /a tmpFileCounts-=1
  382. If exist "%systemdrive%\AUTOEXEC.BAT" Set /a tmpFileCounts-=1
  383. If exist "%systemdrive%\infcache.1" Set /a tmpFileCounts-=1
  384. Del /a /f /s /q "%SystemRoot%\inf\InfCache.1" >nul 2>nul
  385. DEL /a /f /s /q "%systemdrive%\AUTOEXEC.BAT" >nul 2>nul
  386. DEL /a /f /s /q "%systemdrive%\infcache.1" >nul 2>nul
  387. Set /a jgs=shenys-tmpFileCounts
  388. Title 删除完毕!
  389. cls
  390. echo/%#%%#%
  391. Echo/ 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件
  392. echo/%#%%#%
  393. Echo/ Date:%date%  Time:%time% >>d:\SnJun_log\清理垃圾历史记录.log
  394. Echo/ 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件>>d:\SnJun_log\清理
  395. 垃圾历史记录.log
  396. Echo/ %#%%#%>>d:\SnJun_log\清理垃圾历史记录.log
  397. Msg * /TIME:5 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件.
  398. rem 删除回收站,这里的代码有的系统会提示错误,欢迎各位提出有效的建议!
  399. call :hszql
  400. Exit
  401. :hszql
  402. echo off
  403. color a
  404. cls
  405. rem 删除回收站,这里的代码有的系统会提示错误,欢迎各位提出有效的建议!
  406. rem 这里的代码其实是属于多余的,不过为了彻底清除。因此会考虑直接删除回收站文件夹然后重新创建
  407. 比较彻底。
  408. Echo 删除回收站文件夹...
  409. 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
  410. 2>nul
  411. ping 127.0.1 -n 3 >nul 2>nul
  412. Echo 删除回收站文件夹...
  413. 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
  414. ping 127.0.1 -n 3 >nul 2>nul
  415. Echo 删除回收站文件夹...
  416. 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
  417. >nul 2>nul
  418. ping 127.0.1 -n 3 >nul 2>nul
  419. exit
  420. rem 清理垃圾/临时文件卸载程序
  421. rem 只要是转载出来的所有内容全部不留痕迹的卸载掉.
  422. Echo off&cls&color a&title %date%Uninstall...
  423. echo/&echo/&echo/
  424. echo    是否卸载'清理垃圾程序'组件
  425. echo       Y 继续卸载。
  426. echo       N 退出
  427. set /p xzcx= Y/N
  428. If "%xzcx%"=="n" exit
  429. If "%xzcx%"=="y" goto Uninstall
  430. :Uninstall
  431. Del /s/q "%userprofile%\桌面\清理垃圾升级版.bat" Music.vbs
  432. Del /s/q "%userprofile%\桌面\Music.vbs"
  433. Rd /s/q "%userprofile%\「开始」菜单\程序\清理垃圾升级版"
  434. Del /s/q d:\SnJun_log\*.*
  435. Rd /s/q "d:\SnJun_log"
  436. Msg * /TIME:5 卸载‘清理垃圾升级版’组件完成....
  437. Del /f/s/q %0
  438. Exit
  439. ::::::最终修改日期2011年3月31日::::::
  440. ::::::如果有发现错误或不足的地方,欢迎加本人QQ研究
  441. ::::::接下来将考虑自动更新最新版本功能.
  442. ::::::欢迎跟进研究。______________//SnJun//
  443. ::::程序运行步骤
  444. ::::1,判断是否需要加载组件
  445. ::::2,搜索并计算临时文件数量
  446. ::::3,删除临时文件夹
  447. ::::4,删除回收站,创建回收站,设置回收站属性
  448. ::::5,目前本批处理定版本为: v2.0
  449. ::::6,支持修改和借用. ---菜鸟从模仿中成长!
  450. ::::7,本版本为纯代码,仅仅调用系统资源,无外部插件,个人认为有外部插件会好用一点。
  451. ::::有的朋友不喜欢一些类似的提示,可以考虑直接把选择的几个SET /P 以及下面的IF判断去掉即可。
  452. :::::::::::::::::::::个人信息:::::::::::::::::::::::
  453. ::::::QQ:692172929::::::::::::::::::::::::::::::::::
  454. ::::::Email:[email]snwcw_benben@hotmail.com[/email]
  455. ::::::Blog:http://blog.163.com/qq692172929/
  456. ::::::Network disk:http://qq692172929.ys168.com/
  457. ::::::----BAT----百度贴吧@sn_zood------------------http://tieba.baidu.com/f?kw=bat
  458. ::::::---cn-dos--中国DOS联盟@qq692172929-----------http://www.cn-dos.cn (暂时无法登陆)
  459. ::::::---bathome-批处理之家@qq692172929------------[url]www.bathome.net[/url]
复制代码
By:SnJun
Home: http://www.loodd.com

正在考虑写自动/手动代码.以及一些鸡肋功能。呵呵。完完全全写好可能要2M左右.
其中包括了一点实用的外部程序。
支持的朋友请关注.
By:SnJun
Home: http://www.loodd.com

TOP

好复杂的代码...

TOP

好多啊,不过蛮期待的,顶一个先~

TOP

花心!~
寂寞是黑白的,但黑白不是寂寞,是永恒。BAT 需要的不是可能,而是智慧。

TOP

回复 4# 秋风·飞扬


    不用继续期待了,我猜楼主已经消失了

TOP

回复 6# gawk

这么坟的帖子- -

TOP

垃圾清理3.5 小俊十二年升级四次

原创垃圾清理自己从最入门的开始学最早接触的就是这个批处理,十二年不断优化不断优化。
    欢迎指点。
  1. Echo off
  2. Title /
  3. Color a
  4. rem 创建专用文件夹
  5. If not exist d:\SnJun_log\ md d:\SnJun_log\
  6. rem 判断是否复制自己到D:\SnJun_long下
  7. If not exist d:\SnJun_log\垃圾清理v3.5.bat copy /y %0 d:\SnJun_log\垃圾清理v3.5.bat
  8. If exist d:\SnJun_log\清理垃圾历史记录.log goto qllj
  9. Rem By SnJun QQ:692172929  提醒:本程序有调用代码,请勿直接修改内容。推荐拷贝出去测试学习.By:Sn_zood
  10. Set bta=title /
  11. Set btb=title \
  12. rem 判断是否创建开始菜单
  13. ::::::If not exist d:\SnJun_log\d:\SnJun_log\清理垃圾升级版\ MD "%userprofile%\「开始」菜单\程序\清理垃圾升级版\"
  14. Title \
  15. ::::::copy /y %0 "%userprofile%\「开始」菜单\程序\清理垃圾升级版\清理垃圾升级版.bat"
  16. rem 加载卸载BAT
  17. more +200 %0>>d:\SnJun_log\卸载.bat
  18. more +273 %0>>d:\SnJun_log\关于作者.vbs
  19. ::::::copy /y "d:\SnJun_log\卸载.bat" "%userprofile%\「开始」菜单\程序\清理垃圾升级版\卸载.bat"
  20. Title /
  21. call :ckqr 程序第一次运行,需要加载扩展功能.请稍后...
  22. rem 输出创建时间
  23. Echo/ 第一次运行时间: %date% >d:\SnJun_log\清理垃圾历史记录.log
  24. echo.  加载完成,开始清理垃圾....
  25. :qllj
  26. ::::运行程序的时间统计
  27. Set _time_start=%time%
  28. Set /a hour_start=%_time_start:~0,2%
  29. Set /a minute_start=1%_time_start:~3,2%-100
  30. Set /a second_start=1%_time_start:~6,2%-100
  31. ::::::收集信息---计数::::::
  32. Set /a tmpFileCounts=0
  33. Set jsxs=echo  已经发现 %tmpFileCounts% 个临时文件
  34. Set jsbt=title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  35. Echo 正在收集临时文件信息...&ping 127.0.1 -n 2 >nul 2>nul
  36. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  37. :::::::::::::执行命令核心:::::::::::::
  38. set ckbt=搜索
  39. set fady=dir /b /s /a
  40. set jszcx=+
  41. call :mlzx
  42. :::::ps+3
  43. :::::%SystemRoot%\inf\InfCache.1
  44. :::::%systemdrive%\AUTOEXEC.BAT
  45. :::::%systemdrive%\infcache.1
  46. If exist %SystemRoot%\inf\InfCache.1 Set /a tmpFileCounts+=1
  47. If exist %systemdrive%\AUTOEXEC.BAT Set /a tmpFileCounts+=1
  48. If exist %systemdrive%\infcache.1 Set /a tmpFileCounts+=1
  49. Title 已经发现 %tmpFileCounts% 个临时文件,正在收集临时文件信息...
  50. Set shenys=%tmpFileCounts%
  51. Title 共发现 %tmpFileCounts% 个临时文件
  52. echo 共发现 %tmpFileCounts% 个临时文件,收集完毕.
  53. ::计算搜索所有垃圾所用时间。精确到X天
  54. Set _time_end=%time%
  55. Set /a hour_end=%_time_end:~0,2%
  56. Set /a minute_end=1%_time_end:~3,2%-100
  57. Set /a second_end=1%_time_end:~6,2%-100
  58. if %second_end% lss %second_start% (
  59.     Set /a second_end=%second_end%+60
  60.     Set /a minute_end=%minute_end%-1
  61. )
  62. Set /a second=%second_end%-%second_start%
  63. :: 计算分钟数
  64. if %minute_end% lss %minute_start% (
  65.     Set /a minute_end=%minute_end%+60
  66.     Set /a hour_end=%hour_end%-1
  67. )
  68. Set /a minute=%minute_end%-%minute_start%
  69. :: 计算小时数
  70. if %hour_end% lss %hour_start% (
  71.     Set /a hour_end=%hour_end%+24
  72. )
  73. Set /a hour=%hour_end%-%hour_start%
  74. rem 计时程序结束
  75. cls
  76. Set #=#######################################
  77. echo %#%
  78. echo  共发现 %tmpFileCounts% 个临时文件,用时:%hour%时%minute%分%second%秒
  79. echo %#%
  80. if /I "%tmpFileCounts%"=="0" goto qsd
  81. call :ckdy 共发现%tmpFileCounts%个临时文件.用时:%hour%时%minute%分%second%秒,是否删除临时文件(否为退出)
  82. if "%MyVar%"=="6" goto ddlj
  83. if "%MyVar%"=="7" goto q
  84. ::::::::::::::::::::::::::::::::::::::::::::::::::
  85. ::::::::::::::::::::::::::::::::::::::::::::::::::
  86. :qsd
  87. Echo/ Date:%date%  Time:%time% >>d:\SnJun_log\清理垃圾历史记录.log
  88. Echo/ 未发现临时文件,系统保护的非常好. >>d:\SnJun_log\清理垃圾历史记录.log
  89. Echo/ %#%%#%>>d:\SnJun_log\清理垃圾历史记录.log
  90. call :ckqr 未发现临时文件,系统保护的很好,用时:%hour%时%minute%分%second%秒提示,按确定退出.
  91. exit
  92. :q
  93. call :ckqr 谢谢使用,按确定退出.
  94. exit
  95. :ddlj
  96. cls
  97. echo 清理系统缓存...
  98. start "缓存清理中,请稍后..." sfc.exe /purgecache
  99. :::::::::::::执行命令核心:::::::::::::
  100. set ckbt=删除
  101. set fady=del /f /s /q
  102. set jszcx=-
  103. call :mlzx
  104. Title 剩余 %tmpFileCounts% 个临时文件,正在删除临时文件...
  105. If exist "%SystemRoot%\inf\InfCache.1" (
  106. Set /a tmpFileCounts-=1
  107. Del /a /f /s /q "%SystemRoot%\inf\InfCache.1" >nul 2>nul
  108. )
  109. If exist "%systemdrive%\AUTOEXEC.BAT" (
  110. Set /a tmpFileCounts-=1
  111. DEL /a /f /s /q "%systemdrive%\AUTOEXEC.BAT" >nul 2>nul
  112. )
  113. If exist "%systemdrive%\infcache.1" (
  114. Set /a tmpFileCounts-=1
  115. DEL /a /f /s /q "%systemdrive%\infcache.1" >nul 2>nul
  116. )
  117. Set /a jgs=shenys-tmpFileCounts
  118. Title 删除完毕!
  119. Cls
  120. Echo/%#%%#%
  121. Echo/ 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件
  122. Echo/%#%%#%
  123. Echo/ Date:%date%  Time:%time% >>d:\SnJun_log\清理垃圾历史记录.log
  124. Echo/ 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件>>d:\SnJun_log\清理垃圾历史记录.log
  125. Echo/ %#%%#%>>d:\SnJun_log\清理垃圾历史记录.log
  126. Call :ckqr 剩余%tmpFileCounts%个无法删除或正在使用的文件,删除了%jgs%个临时文件.
  127. rem 删除回收站
  128. Call :hszql
  129. rem 到此处,程序执行完毕....exit 退出。
  130. Exit
  131. :mlzx
  132. :::::   call :sswj %1 %2 %3(标题)    %4 %5 %6 %7  (路径)  
  133. :: cookies 如果不想清理直接再下面一行 call前面打2个冒号 ::
  134. call :sswj 上网用的表单 用户名密码记录 cookies... %userprofile%\cookies\*.*
  135. call :sswj 系统 临时 目录... %temp%\*.*
  136. call :sswj 系统 临时 目录... %programdata%\temp\*.*
  137. call :sswj 系统 更新日志 文件... %windir%\KB*.log
  138. call :sswj 系统 冗余 文件... %systemdrive%\*.tmp
  139. call :sswj 系统 冗余 文件... %systemdrive%\*._mp
  140. call :sswj 系统 冗余 文件... %systemdrive%\*.log
  141. call :sswj 系统 冗余 文件... %systemdrive%\*.gid
  142. call :sswj 系统 冗余 文件... %systemdrive%\*.chk
  143. call :sswj 系统 冗余 文件... %systemdrive%\*.old
  144. call :sswj windows 目录下的 备份文件... %windir%\*.bak
  145. call :sswj windows prefetch 预读文件... %windir%\prefetch\*.*
  146. call :sswj 最近 打开的 文档列表记录... %userprofile%\recent\*.*
  147. call :sswj IE 临时 文件... %userprofile%\Local Settings\Temporary Internet Files\*.*
  148. call :sswj 当前帐户 临时文件夹中的 临时文件... %userprofile%\Local Settings\Temp\*.*
  149. call :sswj 当前帐户 历史记录 列表... %windir%\History\*.*
  150. call :sswj 当前帐户 最近浏览文件的 快捷方式... %userprofile%\recent\*.*
  151. call :sswj 系统 预编译 文件... %systemRoot%\inf\*.pnf
  152. call :sswj IE 脱机 文件... %SystemRoot%\Offline Web Pages
  153. call :sswj 系统 小存储器 转储文件记录minidump... %SystemRoot%\minidump\*.*
  154. call :sswj C盘 回收站 垃圾... c:\recycler\*.*
  155. call :sswj D盘 回收站 垃圾... d:\recycler\*.*
  156. call :sswj E盘 回收站 垃圾... e:\recycler\*.*
  157. call :sswj F盘 回收站 垃圾... f:\recycler\*.*
  158. call :sswj G盘 回收站 垃圾... g:\recycler\*.*
  159. call :sswj H盘 回收站 垃圾... h:\recycler\*.*
  160. goto :eof
  161. rem 搜索文件子程序
  162. :sswj
  163. title 正在%ckbt% %1 %2 %3
  164. For /f "delims= tokens=*" %%A in ('%fady% "%4 %5 %6 %7"') do (
  165. Set /a tmpFileCounts%jszcx%=1
  166. cls
  167. echo. 正在努力%ckbt%更多垃圾,请稍后...
  168. )
  169. goto :eof
  170. rem 清理回收站子程序
  171. :hszql
  172. echo off
  173. color a
  174. cls
  175. Echo 删除回收站文件夹...
  176. 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
  177. ping 127.0.1 -n 3 >nul 2>nul
  178. Echo 还原回收站文件夹...
  179. 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
  180. ping 127.0.1 -n 3 >nul 2>nul
  181. Echo 还原回收站文件夹...
  182. 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
  183. ping 127.0.1 -n 3 >nul 2>nul
  184. goto :eof
  185. rem 清理垃圾/临时文件卸载程序
  186. rem 只要是转载出来的所有内容全部不留痕迹的卸载掉.
  187. Echo off&cls
  188. title 卸载SnJun的所有作品....
  189. call :ckdy 是否卸载'SnJun的所有作品'(否为退出)
  190. if "%MyVar%"=="6" goto Uninstall
  191. if "%MyVar%"=="7" exit
  192. :Uninstall
  193. Del /s/q "%userprofile%\桌面\垃圾清理v3.5.bat"
  194. Del /s/q "%userprofile%\桌面\Music.vbs"
  195. Rd /s/q "%userprofile%\「开始」菜单\程序\清理垃圾升级版"
  196. Del /s/q d:\SnJun_log\*.*
  197. RD /s/q "d:\SnJun_log"
  198. del /s/q "d:\SnJun_log"
  199. pause
  200. call :ckqr 卸载‘SnJun的所有作品’完成....
  201. Del /f/s/q %0
  202. Exit
  203. ::::::::::::::::::::::::::::::::::::::::::::::::::
  204. :::::::修改时间2016年1月23日
  205. :::::::1,简化了核心代码。 :sswj
  206. :::::::2,增加了新的搜索范围。
  207. :::::::3,版本提升为3.5。
  208. :::::::4,上个版本的预期未达到 暂时不考虑鼠标键盘支持,因为没必要。
  209. :::::::5, SnJun/// 论坛ID:qq692172929
  210. :::::::6,时隔两年技术再次成长,代码再次优化。
  211. :::::::7,下次更新会带上读写配置文件程序更加人性化。★
  212. ::::::::::::::::::::::::::::::::::::::::::::::::::
  213. :::::::修改时间2014年3月23日
  214. :::::::1,把第三方cido取消 改为调用VBS实现选择。
  215. :::::::2,由于不用编译了,因此直接判断历史记录是否存在
  216. :::::::3,版本提升为3.1。
  217. :::::::4,预计下次版本为彩色尽可能支持鼠标键盘操作
  218. :::::::5,SnJun/// 论坛ID:qq692172929
  219. :::::::::时隔三年!!!这次进度很慢,下个版本会快很多。敬请期待。
  220. ::::::::::::::::::::::::::::::::::::::::::::::::::
  221. ::::::修改日期2011年3月31日::::::
  222. ::::::如果有发现错误或不足的地方,欢迎加本人QQ研究
  223. ::::::接下来将考虑自动更新最新版本功能.
  224. ::::::欢迎跟进研究。______________//SnJun//
  225. ::::程序运行步骤
  226. ::::1,判断是否需要加载组件
  227. ::::2,搜索并计算临时文件数量
  228. ::::3,删除临时文件夹
  229. ::::4,删除回收站,创建回收站,设置回收站属性
  230. ::::5,目前本批处理定版本为: v3.0
  231. ::::6,支持修改和借用. ---菜鸟从模仿中成长!
  232. :::::::::::::::::::::个人信息:::::::::::::::::::::::
  233. ::::::QQ:692172929::::::::::::::::::::::::::::::::::
  234. ::::::Email:snwcw_benben@hotmail.com
  235. ::::::Blog:http://blog.163.com/qq692172929/
  236. ::::::Network disk:http://qq692172929.ys168.com/
  237. rem 弹窗子程序---确认
  238. :ckqr
  239. mshta vbscript:msgbox("%1 %2 %3 %4",64,"清理垃圾提醒:")(window.close)
  240. goto :EOF
  241. rem 弹窗子程序---选择
  242. :ckdy
  243. >%tmp%\tmp.vbs echo MyVar=MsgBox ("%1 %2 %3 %4", 4, "垃圾清理提醒:"):Wscript.Echo MyVar
  244. for /f "delims=*" %%i in ('cscript.exe //nologo %tmp%\tmp.vbs') do set MyVar=%%i
  245. pushd %tmp%&del/q "%a%?" tmp.vbs 2>nul
  246. goto :EOF
  247. msgbox "平时下班没事,自己学了一点批处理的知识,发现奥妙无"+vbCrlf+"穷,让人不得不对其能够实现的功能另眼相看!其实本人"+vbCrlf+"现在也只是学了其中的一点皮毛而已,一时无法领会其精"+vbCrlf+"                2011.08"+vbCrlf+"E-mail:692172929@qq.com"+vbCrlf+"QQ:692172929"+vbCrlf+"          By:小俊"+vbCrlf+"            本人作品根目录:D:\SnJun_log\",,"关于作者                 ◎开心最好◎"
复制代码
By:SnJun
Home: http://www.loodd.com

TOP

回复 6# gawk


    楼主从未消失,一直在各个Q群里逗留。 比较少逛论坛到时真的。
By:SnJun
Home: http://www.loodd.com

TOP

本帖请求转至原创………………
By:SnJun
Home: http://www.loodd.com

TOP

返回列表