Board logo

标题: [系统相关] [代码征集]批处理删除系统垃圾 [打印本页]

作者: youxi01    时间: 2007-12-6 18:46     标题: [代码征集]批处理删除系统垃圾

这个是老题材了,有很多的源代码,参考代码(转自黑蚂蚁):
  1. @echo off 转自黑蚂蚁www.hackant.com  
  2. echo 正在清除系统垃圾文件,请稍等...... 转自黑蚂蚁www.hackant.com  
  3. del /f /s /q %systemdrive%\*.tmp 转自黑蚂蚁www.hackant.com  
  4. del /f /s /q %systemdrive%\*._mp 转自黑蚂蚁www.hackant.com  
  5. del /f /s /q %systemdrive%\*.log 转自黑蚂蚁www.hackant.com  
  6. del /f /s /q %systemdrive%\*.gid 转自黑蚂蚁www.hackant.com  
  7. del /f /s /q %systemdrive%\*.chk 转自黑蚂蚁www.hackant.com  
  8. del /f /s /q %systemdrive%\*.old 转自黑蚂蚁www.hackant.com  
  9. del /f /s /q %systemdrive%\recycled\*.* 转自黑蚂蚁www.hackant.com  
  10. del /f /s /q %windir%\*.bak 转自黑蚂蚁www.hackant.com  
  11. del /f /s /q %windir%\prefetch\*.* 转自黑蚂蚁www.hackant.com  
  12. rd /s /q %windir%\temp & md %windir%\temp 转自黑蚂蚁www.hackant.com  
  13. del /f /q %userprofile%\cookies\*.* 转自黑蚂蚁www.hackant.com  
  14. del /f /q %userprofile%\recent\*.* 转自黑蚂蚁www.hackant.com  
  15. del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" 转自黑蚂蚁www.hackant.com  
  16. del /f /s /q "%userprofile%\Local Settings\Temp\*.*" 转自黑蚂蚁www.hackant.com  
  17. del /f /s /q "%userprofile%\recent\*.*" 转自黑蚂蚁www.hackant.com  
  18. echo 清除系统LJ完成! 转自黑蚂蚁www.hackant.com  
  19. echo. & pause 转自黑蚂蚁www.hackant.com  
  20. 转自黑蚂蚁www.hackant.com
复制代码


重写题材的代码要求:
1、更加精练、简洁;
2、涉及内容更全,也更安全
3、最好配有解释...
作者: 随风    时间: 2007-12-7 15:22

精练谈不上,我都不知道到底哪些才是系统垃圾。
帖一段我自己用的上来看看。
:
  1. @echo off
  2. echo  垃圾清理正在运行,请稍后…………
  3. rd /s /q %windir%\temp & md %windir%\temp
  4. del /f /s /q %windir%\*.bak
  5. del /f /q "%userprofile%\cookies\*.*"
  6. for %%a in (tmp _mp log gid chk old) do (
  7.    del /f /s /q "%systemdrive%\*.%%a"
  8. )
  9. del /f /s /q "%systemdrive%\recycled\*.*"
  10. del /f /s /q "%windir%\prefetch\*.*"
  11. del /f /s /q "%userprofile%\recent\*.*"
  12. del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
  13. del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
  14. ::清除文件缓存  XP系统是:C:\windows\system32\dllcache下的所有文件 清理系统缓存
  15. sfc /purgecache
  16. color 0a&echo 清除系统垃圾文件完成!
  17. echo\&pause&exit
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2