您的位置:首页 > 其它

自动磁盘碎片整理

2006-07-07 17:16 344 查看
计算机在长期使用之后必然会有性能下降,这是因为应用程序的使用会产生很多磁盘碎片文件和一些临时文件或缓存文件,这必然导致磁盘的利用率下降。为了保持计算机更为流畅的运行我们需定期对磁盘碎片进行整理并对垃圾文件进行清理,今天我们的话题就是让垃圾文件的清理和磁盘碎片整理自动化。

以下批处理可以帮助我们对系统上的临时文件和无用的日志或备份文件进行一个清理。

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% / recycled /* . *
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/*.* "

在系统清理完成后我们需要调用Defrag命令来对磁盘进行碎片整理。以对C盘进行磁盘整理为例,我们只需执行:
C:/>defrag c:/ -v -f > c:/defrag.txt命令就可以了。其中-f参数是指如果磁盘空间不足也进行碎片整理。-v参数是指对整理后的磁盘状况结果进行详细描述。然后我用>符号将整理结果重定向到了一个defrag.txt文件中,以便查看。

有了以上两个命令行的磁盘清理和碎片整理的方式,我们就可以通过任务计划来进行定期执行。而不用我们来手动执行了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  磁盘 cookies 任务 c