C盘清理批处理脚本

来源:互联网 发布:2016年java程序员工资 编辑:程序博客网 时间:2024/05/22 02:13

文章转自:http://www.bk80.com/blog/783.html

 系统在运行的时候,会产生大量的系统垃圾和缓存,比如我们在视频网站在线观看电影时,看似没有下载什么东西,其实缓存文件正在往系统里猛装,久而久之,C盘会越来越大。我曾经在邻居家的电脑里清除了8G的系统垃圾和缓存,可想那台电脑的系统垃圾有多么多。不过不管你有多少G,下面这个批处理文件会在几十秒内把消失干净。
       首先在非系统盘创建一个文本文档,打开后复制进下面代码:

[plain] view plain copy
  1. @echo off      
  2. echo 正在清除系统垃圾文件,请稍等……      
  3. del /f /s /q %systemdrive%\*.tmp      
  4. del /f /s /q %systemdrive%\*._mp      
  5. del /f /s /q %systemdrive%\*.log      
  6. del /f /s /q %systemdrive%\*.gid      
  7. del /f /s /q %systemdrive%\*.chk      
  8. del /f /s /q %systemdrive%\*.old      
  9. del /f /s /q %systemdrive%\recycled\*.*      
  10. del /f /s /q %windir%\*.bak      
  11. del /f /s /q %windir%\prefetch\*.*      
  12. rd /s /q %windir%\temp & md %windir%\temp      
  13. del /f /q %userprofile%\COOKIES s\*.*      
  14. del /f /q %userprofile%\recent\*.*      
  15. del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"      
  16. del /f /s /q "%userprofile%\Local Settings\Temp\*.*"      
  17. del /f /s /q "%userprofile%\recent\*.*"      
  18. sfc /purgecache ‘清理系统盘无用文件      
  19. defrag %systemdrive% -b ‘优化预读信息      
  20. echo 清除系统LJ完成!      
  21. echo. & pause     

      保存后,把文件的后缀名txt改成bat,如果不能修改,打开文件夹选项把隐藏已知文件类型的扩展名,把前面的对号去掉,就可以修改了。
      这个批处理的bat文件已经伴随我的电脑生涯快十年了,虽然中间换过多台电脑,抛弃了许多的软件,但这个文件一直跟随着我,相信许多玩电脑的朋友电脑里也都有这个文件,我把它起名为:清理C盘,不知道朋友们是怎么给它起的名字。这个批处理文件最强的地方是速度,你可以对比一下,无论360、优化大师、鲁大师等等系统清理工具,和这个来比一下速度,会发现快的太多太多了。


0 0