第一篇:電腦技術(shù)-簡單批處理命令就能徹底有效清理電腦中的垃圾
簡單批處理命令就能徹底有效清理電腦中的垃圾
用簡單的批處理命令文件就可以真正有效徹底的清理電腦中的殘余垃圾,一直珍藏中。下面是代碼:
-----------------------開始(請(qǐng)勿粘貼此行)---------------------------@echo off
color 70
Title 系統(tǒng)垃圾文件清理
echo.echo ***** 系統(tǒng)垃圾文件清理器 *****
echo 制作:36389232
echo.echo 本程序特點(diǎn):
echo 鑒于很多人把IE緩存等文件夾轉(zhuǎn)移到非系統(tǒng)盤,echo 所以,本程序清理垃圾文件時(shí),首先進(jìn)行判斷系統(tǒng)
echo 的設(shè)置。
echo.echo 優(yōu)點(diǎn):清理位置更加準(zhǔn)確,策略更加科學(xué)。
echo.echo 開始執(zhí)行清理??
echo.echo 正在檢查cookies、歷史紀(jì)錄等目錄位置(當(dāng)前用戶)??
reg query “HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders” /v Cache>%temp%cleantmp.txt
reg query “HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders” /v Cookies>>%temp%cleantmp.txt
reg query “HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders” /v History>>%temp%cleantmp.txt
reg query “HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders” /v NetHood>>%temp%cleantmp.txt
reg query “HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders” /v Recent>>%temp%cleantmp.txt
echo 正在清理Cookies、IE緩存、歷史紀(jì)錄等(當(dāng)前用戶)??
for /f “tokens=3*” %%a in(%temp%cleantmp.txt)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)
::跟上面幾項(xiàng)未必是重復(fù)的(!),也是對(duì)當(dāng)前用戶目錄
echo 正在清理臨時(shí)文件(系統(tǒng)目錄)??
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%..IconCache.db” >Nul 2>Nul
echo 正在清理系統(tǒng)目錄中的垃圾文件(稍候,需要點(diǎn)時(shí)間)??
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%vTmp.txt
for /f %%a in(%SystemRoot%vTmp.txt)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 正在清除無用的磁盤檢錯(cuò)文件(系統(tǒng)分區(qū))??
del /a /f /q “%SystemDrive%*.chk” >Nul 2>Nul
dir %SystemDrive%found.??? /ad/b >%SystemRoot%vTmp.txt
for /f %%a in(%SystemRoot%vTmp.txt)do rd /s /q “%SystemDrive%%%a” >Nul 2>Nul
echo 正在清理系統(tǒng)升級(jí)補(bǔ)丁留下來的反安裝目錄(已修正能正確清除)??
dir %SystemRoot%$*$ /ad/b >%SystemRoot%vTmp.txt
for /f %%a in(%SystemRoot%vTmp.txt)do rd /s /q “%SystemRoot%%%a” >Nul 2>Nul
echo 正在清除常見的軟件垃圾項(xiàng)目(按默認(rèn)目錄)??
rd /s /q “%ProgramFiles%InstallShield Installation Information” >Nul 2>Nul
Ren “%ProgramFiles%Common~1RealUpdate_OBrealsched.exe” realsched.ex_ >Nul 2>Nul
Del “%ProgramFiles%Common~1RealUpdate_OBrealsched.exe” >Nul 2>Nul
Reg Delete “HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun” /v TkBellExe /f >Nul 2>Nul
rd /s /q “%ProgramFiles%TencentQQGameDownload” >Nul 2>Nul
taskkill /f /im “TIMPlatform.exe” /t >Nul 2>Nul
del /a /f /s /q “%ProgramFiles%TencentQQTIMPlatform.exe” >Nul 2>Nul
del /a /f /s /q “%ProgramFiles%PKaspersky Lab*.tmp” >Nul 2>Nul
echo.del %SystemRoot%vTmp.txt
-----------------------結(jié)束(請(qǐng)勿粘貼此行)---------------------------把上面的代碼粘貼到記事本里面,另存為“清理垃圾.bat” 文檔,使用時(shí)點(diǎn)擊運(yùn)行就可。