• [教训] windows 电脑的垃圾文件清理...


    坑你没商量!

    这个名叫 “清除系统垃圾.bat“ 的文件在网上传播很广,但是,却出现了错误的版本,如果按照它逐条执行,将导致系统文件夹被一锅端,只能再重装的悲剧!

    举个栗子:

    错误版本:http://blog.163.com/lym_fn/blog/static/114724703200991785146568/ (错版的代码)

    @echo off
    echo 正在清除系统垃圾文件,请稍等……
    del /f /s /q %systemdrive%*.tmp
    del /f /s /q %systemdrive%*._mp
    del /f /s /q %systemdrive%*.log
    del /f /s /q %systemdrive%*.gid
    del /f /s /q %systemdrive%*.chk
    del /f /s /q %systemdrive%*.old
    del /f /s /q %systemdrive% ecycled*.*
    del /f /s /q %windir%*.bak
    del /f /s /q %windir%prefetch*.*
    rd  /s /q %windir% emp & md %windir% emp (!!!! 这句是错误的写法)
    del /f /q %userprofile%cookies*.*
    del /f /q %userprofile%\recent\*.*
    del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
    del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
    del /f /s /q "%userprofile%\recent\*.*"
    echo 清除系统LJ完成!
    echo. & pause

    正确版本:http://www.cnbeta.com/articles/206139.htm (正确的代码,并且有详细的解释)

    @echo off
    echo 正在清除系统垃圾文件,请稍等……
    del /f /s /q %systemdrive%*.tmp
    del /f /s /q %systemdrive%*._mp
    del /f /s /q %systemdrive%*.log
    del /f /s /q %systemdrive%*.gid
    del /f /s /q %systemdrive%*.chk
    del /f /s /q %systemdrive%*.old
    del /f /s /q %systemdrive% ecycled*.*
    del /f /s /q %windir%*.bak
    del /f /s /q %windir%prefetch*.*
    rd  /s /q %windir%\temp & md %windir%\temp  (!!!! 这句才是正确的写法)
    del /f /q %userprofile%cookies*.*
    del /f /q %userprofile%\recent\*.*
    del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
    del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
    del /f /s /q "%userprofile%\recent\*.*"
    echo 清除系统LJ完成!
    echo. & pause

    悲剧的是,为了尝试内存释放,我使用了错误的版本,立即导致系统图标变成白色的小方块,“开始“ 里面的软件快捷方式几乎都失效,只能再一个个重新添加。但是 office 却无法再使用了,提示 “MSVCR100.dll" 文件不存在,即使从别的电脑了拷贝了同名文件到相应的安装目录下,依然解决不了问题。重启之后,无法进入系统,系统还原点不存在,备份也没有,系统恢复同样不成功。作为始作俑者, 不敢再擅自操作,只能联系服务器的专业维护人员,估计只能重装了。登录命令台窗口看到的结果是,系统盘下的内容,比如 boot 文件夹都不存在了,自然是无法启动的。

    幸好在网上提问,有人发现了错误源于下面这句:

    " rd /s /q %windir%\ emp & md %windir%\ emp"

    它的正确写法是 “rd /s /q %windir%\temp & md %windir%\temp”, 本意是要删除系统目录下的临时文件夹中的内容。

    但错误写法导致它的实际执行结果成了 “rd /s /q %windir%\ & md %windir%\”。

    可以确定的是,以后我不会再用这种垃圾清理的命令了。内存的问题,用重启来解决。再折腾,真是伤不起了。

    又一失足,千古!

  • 相关阅读:
    【Lintcode】112.Remove Duplicates from Sorted List
    【Lintcode】087.Remove Node in Binary Search Tree
    【Lintcode】011.Search Range in Binary Search Tree
    【Lintcode】095.Validate Binary Search Tree
    【Lintcode】069.Binary Tree Level Order Traversal
    【Lintcode】088.Lowest Common Ancestor
    【Lintcode】094.Binary Tree Maximum Path Sum
    【算法总结】二叉树
    库(静态库和动态库)
    从尾到头打印链表
  • 原文地址:https://www.cnblogs.com/snake553/p/5092251.html
Copyright © 2020-2023  润新知