1、新建一个txt文件
2、将如下代码复制进入该txt文件
@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
:: 清理Windows目录下的临时文件和备份文件
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
for /d %%x in ("%windir%\temp*") do @rd /s /q "%%x"
md %windir%\temp
:: 清理用户临时文件夹和cookies
del /f /q %userprofile%\AppData\Roaming\Microsoft\Windows\Cookies\*.*
del /f /s /q "%userprofile%\AppData\Local\Temp\*.*"
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" :: 注意:对于较新系统,此路径可能已更改
:: 清理用户最近的文件列表(但注意这可能会根据系统设置而有所不同)
del /f /q %userprofile%\Recent\*.*
echo 系统垃圾清除完毕!
echo. & pause3、 将txt文件后缀修改为bat
4、点击运行即可,若需要清理彻底,可以使用管理员身份运行
本文参考至,对其中部分内容进行了优化


发布评论