是一个清理系统垃圾文件并关机的bat文件

来源:互联网 发布:matlab 定义符号矩阵 编辑:程序博客网 时间:2024/05/22 13:01

是一个清理系统垃圾文件并关机的bat文件,

把下面的内容复制到txt文档中,并以bat文件名保存,

把它放在桌面上,想关机单击它就行了;

以后就可以一键关机并且清除系统垃圾文件,

是保护电脑的好帮手。增加了清理前结束程序,

  不用一个个手动结束程序了 

@echo off
Taskkill /f /fi "username eq %username%" /FI "IMAGENAME ne cmd.exe" /FI "IMAGENAME ne explorer.exe"
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%/*.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/*.*"
Shutdown  -f -s -t 0

 

上面只能关闭进程,不能关闭打开的文件夹。

如果想关闭文件夹的,就用下面的:

@echo off
Taskkill /f /fi "username eq %username%" /FI "IMAGENAME ne cmd.exe" 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%/*.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/*.*"
Shutdown  -f -s -t 0

原创粉丝点击