优化大师、超级兔子……清除系统垃圾文件的确方便,但是单单依靠第三方软件为我们服务,我想我们永远都不可能成为“电脑专家”。方法才是王道,如何实现系统垃圾文件的清理?毋庸置疑,批处理是最好的选择!
1、批处理的常见命令。
echo命令:打开回显或关闭回显请求功能,显示消息。
@命令:表示不显示@后面的命令。
/f:删除只读文件。
/s:删除子目录中的文件。
/q:安静模式,不询问。
*.*等同于.:表示所有文件。
pause:暂停。
%systemdrive%:代表系统盘。如:c:\
%systemroot%:系统文件夹。如:c:\windows
%userprofile%:当前用户。
(其他命令均可在windows的cmd下输入/?查看帮助)
2、windows的垃圾文件扩展名。
.tmp:临时文件。
._mp:临时文件。
.log:日志文件。
.gid:临时帮助文件。
.old:备份的临时文件。
.bak:安装时存在的临时文件。
示例:
@color 0A //新窗口显示为黑底、绿字
@echo 垃圾文件清除
@pause
@del /f /s /q %systemdrive%\*.tmp
@del /f /s /q %systemdrive%\*._mp
@del /f /s /q %systemdrive%\*.gid
@del /f /s /q %systemdrive%\*.old
@del /f /s /q %systemdrive%\*.bak
@echo 清除完毕!
@pause
2、回收站中的文件
回收站文件夹为隐藏,目录为:c:\recycler
删除命令为:
@del /f /s /q %systemdrive%\recycler\.
3、prefetch文件夹
此文件夹中的文件是windows自动创建的,加快系统启动速度,但是日久天长文件积累越来越多,反而导致系统启动速度变慢,所以建议删除。
文件目录:c:\windows\prefetch\ (xp,2003)
c:\winnt\prefetch\ (2000)
上述目录表示为:%systemroot%\prefetch\
命令为:
@del /f /s /q %systemroot%\prefetch\.
4、用户临时文件
目录如下:
1、c:\windows\temp
2、c:\documents and setting\administrator\cookies\
3、c:\documents and setting\administrator\recent\ (最近打开的文挡中的文件)
4、c:\documents and setting\administrator\local settings\ (共有三文件夹:history , temp , temporary internet files)
命令:
1、@del /f /s /q %systemdrive%\temp\.
2、@del /f /s /q "%userprofile%\cookies\."
3、@del /f /s /q "%userprofile%\recent\."
4、@del /f /s /q "%userprofile%\local settings\history\."
5、@del /f /s /q "%userprofile%\local settings\temp\."
6、@del /f /s /q "%userprofile%\local settings\temproary internet files\."
现在将以上命令编写到txt文本文件中,然后保存为.bat格式的文件即可。设置如下:
@color 0A
@echo 正在清除系统垃圾文件,请稍等……
@pause
@del /f /s /q %systemdrive%\*.tmp
@del /f /s /q %systemdrive%\*._mp
@del /f /s /q %systemdrive%\*.gid
@del /f /s /q %systemdrive%\*.old
@del /f /s /q %systemdrive%\*.bak
@del /f /s /q %systemroot%\prefetch\.
@del /f /s /q %systemdrive%\temp\.
@del /f /s /q "%userprofile%\cookies\."
@del /f /s /q "%userprofile%\recent\."
@del /f /s /q "%userprofile%\local settings\history\."
@del /f /s /q "%userprofile%\local settings\temp\."
@del /f /s /q "%userprofile%\local settings\temproary internet files\."
@del /f /s /q %systemdrive%\recycler\.
@echo 系统垃圾清除完毕!
@pause