2023年12月7日发(作者:)
简单批处理命令就能彻底有效清理电脑中的垃圾
用简单的批处理命令文件就可以真正有效彻底的清理电脑中的残余垃圾,一直珍藏中。
下面是代码:
-----------------------开始(请勿粘贴此行)---------------------------
@echo off
color 70
Title 系统垃圾文件清理
echo.
echo ***** 系统垃圾文件清理器 *****
echo 制作:36389232
echo.
echo 本程序特点:
echo 鉴于很多人把IE缓存等文件夹转移到非系统盘,
echo 所以,本程序清理垃圾文件时,首先进行判断系统
echo 的设置。
echo.
echo 优点:清理位置更加准确,策略更加科学。
echo.
echo 开始执行清理„„
echo.
echo 正在检查cookies、历史纪录等目录位置(当前用户)„„
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v
Cache>%temp%
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v
Cookies>>%temp%
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v
History>>%temp%
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v
NetHood>>%temp%
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v
Recent>>%temp%
echo 正在清理Cookies、IE缓存、历史纪录等(当前用户)„„
for /f "tokens=3*" %%a in (%temp%) do (
for /d %%i in ("%%a %%b*.*") do rd /s /q "%%i">Nul 2>Nul
del /a /f /s /q "%%a %%b*.*">Nul 2>Nul
)
::跟上面几项未必是重复的(!),也是对当前用户目录
echo 正在清理临时文件 (系统目录)„„
del /a /f /s /q "%userprofile%Locals~1Tempor~1*.*" >Nul 2>Nul
del /a /f /s /q "%userprofile%Locals~1Temp*.*" >Nul 2>Nul
del /a /f /s /q "%userprofile%cookies*.*" >Nul 2>Nul del /a /f /s /q "%userprofile%recent*.*" >Nul 2>Nul
del /a /f /s /q "%Temp%*.*" >Nul 2>Nul
del /a /f /s /q "%Tmp%*.*" >Nul 2>Nul
del /a /f /s /q "%HomePath%.." >Nul 2>Nul
echo 正在清理系统目录中的垃圾文件 (稍候,需要点时间)„„
del /a /f /s /q "%SystemRoot%*._mp">Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.bak">Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.log">Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.dmp">Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.gid">Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.old">Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.query">Nul 2>Nul
del /a /f /q "%SystemRoot%*.tmp">Nul 2>Nul
rd /s /q "%SystemRoot%Downloaded Program Files" >Nul 2>Nul
rd /s /q "%SystemRoot%Offline Web Pages" >Nul 2>Nul
rd /s /q "%systemroot%Connection Wizard" >Nul 2>Nul
rd /s /q "%SystemRoot%SoftwareDistributionDownload" >Nul 2>Nul
rd /s /q "%SystemRoot%Assembly" >Nul 2>Nul
rd /s /q "%SystemRoot%Help" >Nul 2>Nul
rd /s /q "%SystemRoot%ReinstallBackups" >Nul 2>Nul
del /a /s /q "%SystemRoot%inf*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%infInfCache.1" >Nul 2>Nul
dir %SystemRoot%inf*.* /ad/b >%SystemRoot%
for /f %%a in (%SystemRoot%) do rd /s /q "%SystemRoot%inf%%a" >Nul
2>Nul
del /a /f /s /q "%SystemRoot%driver?*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%driver?InfCache.1" >Nul 2>Nul
del /a /f /s /q "%SystemDrive%driver?*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemDrive%driver?InfCache.1" >Nul 2>Nul
rd /s /q "%SystemRoot%temp" & md "%SystemRoot%temp" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%Prefetch*.*">Nul 2>Nul
del /a /f /s /q "%SystemRoot%minidump*.*">Nul 2>Nul
echo 正在清除无用的磁盘检错文件 (系统分区)„„
del /a /f /q "%SystemDrive%*.chk" >Nul 2>Nul
dir %SystemDrive%found.??? /ad/b >%SystemRoot%
for /f %%a in (%SystemRoot%) do rd /s /q "%SystemDrive%%%a" >Nul 2>Nul
echo 正在清理系统升级补丁留下来的反安装目录 (已修正能正确清除)„„
dir %SystemRoot%$*$ /ad/b >%SystemRoot%
for /f %%a in (%SystemRoot%) do rd /s /q "%SystemRoot%%%a" >Nul 2>Nul
echo 正在清除常见的软件垃圾项目 (按默认目录)„„
rd /s /q "%ProgramFiles%InstallShield Installation Information" >Nul 2>Nul
Ren "%ProgramFiles%Common~1RealUpdate_" _ >Nul
2>Nul
Del "%ProgramFiles%Common~1RealUpdate_" >Nul 2>Nul Reg Delete "HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun" /v TkBellExe
/f >Nul 2>Nul
rd /s /q "%ProgramFiles%TencentQQGameDownload" >Nul 2>Nul
taskkill /f /im "" /t >Nul 2>Nul
del /a /f /s /q "%ProgramFiles%" >Nul 2>Nul
del /a /f /s /q "%ProgramFiles%PKaspersky Lab*.tmp" >Nul 2>Nul
echo.
del %SystemRoot%
-----------------------结束(请勿粘贴此行)---------------------------
把上面的代码粘贴到记事本里面,另存为“清理垃圾.bat” 文档,使用时点击运行就可。


发布评论