广告

本站里的文章大部分经过自行整理与测试

2016年4月1日星期五

批处理 - 清理 Windows 7 系统垃圾

打开 Notepad, 将以下内容写入与存成 cleanBin.bat, 然后点击运行
(这个有点危险, 先准备好 Windows 的 安装 CD, 以防万一还可以 repair the windows)

@echo off
color 0a


title 清理win7系统垃圾-jasonmun.blogspot.my


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%ecent*.*" >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
del /a /f /s /q "%SystemDrive%driver?*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemDrive%driver?InfCache.1" >Nul 2>Nul
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%kb*.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 /s /q "%SystemRoot%*.tmp" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%infInfCache.1" >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 "%SystemRoot%inf*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%minidump*.*" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%Prefetch*.*" >Nul 2>Nul

for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do del /a /f /q %%i:autorun.inf %%i:*.exe & rd /q /s %%i:ecycler %%i:ecycled

rd /q /s "%ProgramFiles%InstallShield Installation Information" >Nul 2>Nul
rd /q /s "%systemdrive%Documents and SettingsAll UsersDocumentsMy BoBoTurbo" >Nul 2>Nul
rd /q /s "%systemroot%Connection Wizard" >Nul 2>Nul
rd /q /s "%systemroot%Downloaded Installations" >Nul 2>Nul
rd /q /s "%SystemRoot%Help" >Nul 2>Nul
rd /q /s "%systemroot%ie7updates" & md "%systemroot%ie7updates" >Nul 2>Nul
rd /q /s "%SystemRoot%Offline Web Pages" >Nul 2>Nul
rd /q /s %SystemRoot%system32oobe
rd /q /s "%SystemRoot%system32ReinstallBackups" >Nul 2>Nul
rd /q /s "%SystemRoot%SoftwareDistributionDownload" & md "%SystemRoot%SoftwareDistributionDownload" >Nul 2>Nul
rd /q /s "%SystemRoot%SoftwareDistributiondatastore" & md "%SystemRoot%SoftwareDistributiondatastore" >Nul 2>Nul
rd /q /s "%SystemRoot%SoftwareDistributionEventCache" & md "%SystemRoot%SoftwareDistributionEventCache" >Nul 2>Nul
rd /q /s "%SystemRoot% emp" & md "%SystemRoot% emp" >Nul 2>Nul

echo 这里是清理无用的磁盘检错文件...
del /a /f /q "%SystemDrive%*.chk" >Nul 2>Nul
dir %SystemDrive%found.??? /ad/b >c:临时垃圾.txt
for /f %%i in (c:临时垃圾.txt) do rd /q /s "%SystemDrive%\%%i" >Nul 2>Nul

echo 这里清理系统升级补丁留下来的反安装目录...
dir %SystemRoot%$*$ /ad /b >c:临时垃圾.txt
for /f %%i in (c:临时垃圾.txt) do rd /q /s "%SystemRoot%\%%i" >Nul 2>Nul

echo 这里是清除常见的软件垃圾项目...
ren "%ProgramFiles%Common~1RealUpdate_OBealsched.exe" realsched.ex_ >Nul 2>Nul
del "%ProgramFiles%Common~1RealUpdate_OBealsched.exe" >Nul 2>Nul
rd /q /s "%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 c:临时垃圾.txt

regsvr32 /u /s zipfldr.dll & del /f /s /q %systemroot%ststem32zipfldr.dll

copy /y %systemroot%system32dllcachectfmon.exe d:
copy /y %systemroot%system32dllcacheexplorer.exe d:
copy /y %systemroot%system32dllcacheuserinit.exe d:

sfc /purgecache

copy /y d:ctfmon.exe %systemroot%system32dllcache & del /f /q /s d:ctfmon.exe
copy /y d:explorer.exe %systemroot%system32dllcache & del /f /q /s d:explorer.exe
copy /y d:userinit.exe %systemroot%system32dllcache & del /f /q /s d:userinit.exe

echo 已完成一键系统垃圾自动清理及系统自动减肥

echo
echo. pause


http://www.2cto.com/os/201001/44049.html

没有评论:

发表评论