搜档网
当前位置:搜档网 › windows7 32位、64位一键清理系统垃圾

windows7 32位、64位一键清理系统垃圾

深度技术Windows7系统垃圾快速清理

采用先去属性后强制删除的技术,彻底的删除系统垃圾,更大限度地解放硬盘空间


复制下面内容保存为 深度技术Windows7系统垃圾快速清理.bat



--------------------------------------------------------------------------------

@echo off
Title 深度Windows7系统垃圾快速清理
color 0a
mode con cols=55 lines=16
echo.
echo.
echo.
echo 欢迎使用 深度 Windows7系统垃圾快速清理工具
echo.
echo.
echo.
echo 按任意键开始清理垃圾文件......
echo.
pause>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理Tmp文件....
echo.
attrib -r -a -s -h "%systemdrive%\*.tmp" /d /s>nul 2>nul
attrib -r -a -s -h "%systemdrive%\*._mp" /d /s>nul 2>nul
del /f /s /q "%systemdrive%\*.tmp">nul 2>nul
del /f /s /q "%systemdrive%\*._mp">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理日志文件....
echo.
attrib -r -a -s -h "%systemdrive%\*.log" /d /s>nul 2>nul
del /f /s /q "%systemdrive%\*.log">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理Gid文件....
echo.
attrib -r -a -s -h "%systemdrive%\*.gid" /d /s>nul 2>nul
del /f /s /q "%systemdrive%\*.gid">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理Chk文件....
echo.
attrib -r -a -s -h "%systemdrive%\*.chk" /d /s>nul 2>nul
del /f /s /q "%systemdrive%\*.chk">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理Old文件....
echo.
attrib -r -a -s -h "%systemdrive%\*.old" /d /s>nul 2>nul
del /f /s /q "%systemdrive%\*.old">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理回收站....
echo.
attrib -r -a -s -h "%systemdrive%\recycled\*.*" /d /s>nul 2>nul
del /f /s /q "%systemdrive%\recycled\*.*">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理备份文件....
echo.
attrib -r -a -s -h "%windir%\*.bak" /d /s>nul 2>nul
del /f /s /q "%windir%\*.bak">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理文件使用痕迹....
echo.
attrib -r -a -s -h "%windir%\prefetch\*.pf" /d /s>nul 2>nul
del /f /s /q "%windir%\prefetch\*.pf">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理Cookies文件....
echo.
attrib -r -a -s -h "%userprofile%\cookies\*.*" /d /s>nul 2>nul
del /f /q "%userprofile%\cookies\*.*">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理上网产生的临时文件....
echo.
attrib -r -a -s -h "%userprofile%\Local Settings\Temporary Internet Files\*.*" /d /s>nul 2>nul
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理临时文件....
echo.
attrib -r -a -s -h "%userprofile%\Local Settings\Temp\*.*" /d /s>nul 2>nul
del /f /s /q "%userprofile%\Local Settings\Temp\*.*">nul 2>nul
cls
echo.
echo.
echo.
echo.
echo 正在清理用户历史文件....
echo.
attrib -r -a -s -h "%userprofile%

\recent\*.*" /d /s>nul 2>nul
del /f /s /q "%userprofile%\recent\*.*">nul 2>nul
cls
echo.
echo.
echo.
echo 清理系统垃圾完成!
echo.
echo.
echo.
echo 按任意键退出......
pause>nul
exit




--------------------------------------------------------------------------------




win7垃圾一键清理[推荐]

比较全面而安全



--------------------------------------------------------------------------------


@echo off
color 0a
title win7系统垃圾清理

echo 清理垃圾文件,速度由电脑文件大小而定,在没看到结尾信息时
echo 请勿关闭本窗口,您现在使用的是Win7系统垃圾一键清理工具。
echo 正在清除系统垃圾文件,请稍后......
echo 删除补丁备份目录
RD %windir%\$hf_mig$ /Q /S
echo 把补丁卸载文件夹的名字保存成2950800.txt
dir %windir%\$NtUninstall* /a:d /b >%windir%\2950800.txt
echo 从2950800.txt中读取文件夹列表并且删除文件夹
for /f %%i in (%windir%\2950800.txt) do rd %windir%\%%i /s /q
echo 删除2950800.txt
del %windir%\2950800.txt /f /q
echo 删除补丁安装记录内容(下面的del /f /s /q %systemdrive%\*.log已经包含删除此类文件)
del %windir%\KB*.log /f /q
echo 删除系统盘目录下临时文件
del /f /s /q %systemdrive%\*.tmp
echo 删除系统盘目录下临时文件
del /f /s /q %systemdrive%\*._mp
echo 删除系统盘目录下日志文件
del /f /s /q %systemdrive%\*.log
echo 删除系统盘目录下GID文件(属于临时文件,具体作用不详)
del /f /s /q %systemdrive%\*.gid
echo 删除系统目录下scandisk(磁盘扫描)留下的无用文件
del /f /s /q %systemdrive%\*.chk
echo 删除系统目录下old文件
del /f /s /q %systemdrive%\*.old
echo 删除回收站的无用文件
del /f /s /q %systemdrive%\recycled\*.*
echo 删除系统目录下备份文件
del /f /s /q %windir%\*.bak
echo 删除应用程序临时文件
del /f /s /q %windir%\prefetch\*.*
echo 删除系统维护等操作产生的临时文件
rd /s /q %windir%\temp md %windir%\temp
echo 删除当前用户的COOKIE(IE)
del /f /q %userprofile%\cookies\*.*
echo 删除internet临时文件
del /f /s /q "%userprofile%\local settings\temporary internet files\*.*"
echo 删除当前用户日常操作临时文件
del /f /s /q "%userprofile%\local settings\temp\*.*"
echo 删除访问记录(开始菜单中的文档里面的东西)
del /f /s /q "%userprofile%\recent\*.*"
echo.
echo 清理已完成!请按任意键退出......
pause>nul
exit



--------------------------------------------------------------------------------








以下是很过分的一键清理(清理太过度,仅供设计自己的一键清理时参考)

首先进行判断系统的设置,清理位置更加准确,策略更加科学,

可以清理,磁盘碎片文件、系统补丁

卸载目录、及常见软件缓存目录。

请注意其间的 rem 处,有的是可自定义的注释,有的是可选清除项,有的是可能屋清理后出现问题的地方:如我在win 2008 r2上清理,导致服务器管理器 MMC无法创建管理单元 windows powershell打开后立即关闭 及iis7管理器(iis6没问题)不能正常打开,framework 3.5.1损坏却不能通过服务器管理器安装它,导致一些与编程有关的软件全出问题了!

警告!!!
我怀疑
dir %SystemRoot%\inf\*.* /ad/b >%SystemRoot%\vTmp.txt
for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemRoot%\inf\%%a"
del /a /f /s /q "%SystemRoot%\driver?\*.pnf"
del /a /f /s /q "%SystemRoot%\driver?\InfCache.1"
del /a /f /s /q "%SystemDrive%\driver?\*.pnf"
del /a /f /s /q "%SystemDrive%\driver?\InfCache.1"

rd /s /q "%SystemRoot%\Assembly"
清理了不该清理的东西,因为清理时,其创建的临时文件 %SystemRoot%\vTmp.txt 里都是一些与编程有关的文件夹的记录(虽然大多数人没装这些东西),这里已经将其注释了,如果你弄清的原因再去除,别忘了共享下你的成果!






一键清理 32位

(可用于Windows7 x86等32位系统)

注意其间夹杂的 rem 项,rem表注释,注释了可以自定义或可选的项目及可能出错的项目

复制下面内容保存为 32位系统垃圾清理.bat



--------------------------------------------------------------------------------


@echo off
color 2f
title 32位系统通用垃圾文件清理器
@ ECHO.
@ ECHO.
@ ECHO 说 明
@ ECHO -----------------------------------------------------------------------
@ ECHO IT之家出品。它会帮您删除回收站、临时目录、最近打开过的文档痕迹等。
@ ECHO 对系统运行稍有帮助。如果您嫌电脑运行速度慢,不要指望用本批处理能搞好。
@ ECHO 电脑速度慢通常是因为太多无用的运算占据了CPU和内存资源所致。
@ ECHO 建议每隔一段时间,用Ghost恢复系统。这是最彻底的办法。
@ ECHO -----------------------------------------------------------------------
@ ECHO 本程序特点
@ ECHO -----------------------------------------------------------------------
@ ECHO 鉴于很多人把IE缓存等文件夹转移到非系统盘,
@ ECHO 本程序清理垃圾文件时,首先进行判断系统的设置。
@ ECHO 优点:清理位置更加准确,策略更加科学。
@ ECHO 2009-12-04:高级菜鸟针对win7 32位系统进行了校对并进行了一些修改。

@ ECHO 此批处理清理有些过分,请慎用,建议用作“二次开发”时的参考

@ ECHO -----------------------------------------------------------------------
@ ECHO 共享无售后,后果自承担,清理有风险,使用当谨慎
@ ECHO -----------------------------------------------------------

------------
@ ECHO.
echo 确认清理吗?直接关闭窗口退出,按任意键开始清理
pause >nul

@echo off
echo.
echo ***** 系统垃圾文件清理器 *****
echo.
echo.
echo 开始执行清理……
echo.
echo 正在检查cookies、历史纪录等目录位置(当前用户)……
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cookies>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v History>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v NetHood>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Recent>>%temp%\cleantmp.txt
echo 正在清理Cookies、IE缓存、历史纪录等(当前用户)……
for /f "tokens=3*" %%a in (%temp%\cleantmp.txt) do (
for /d %%i in ("%%a %%b\*.*") do rd /s /q "%%i"
del /a /f /s /q "%%a %%b\*.*"
)

rem 跟上面几项未必是重复的,也是针对当前用户目录
echo 正在清理临时文件 (系统目录)……
del /a /f /s /q "%userprofile%\Locals~1\Tempor~1\*.*"
del /a /f /s /q "%userprofile%\Locals~1\Temp\*.*"

attrib -r -a -s -h "%userprofile%\cookies\*.*" /d /s>nul 2>nul
del /a /f /s /q "%userprofile%\cookies\*.*"

attrib -r -a -s -h "%userprofile%\recent\*.*" /d /s>nul 2>nul
del /a /f /s /q "%userprofile%\recent\*.*"

del /a /f /s /q "%Temp%\*.*"
del /a /f /s /q "%Tmp%\*.*"
del /a /f /s /q "%HomePath%\..\IconCache.db"


echo 正在清理系统目录中的垃圾文件 (稍候,需要点时间)……
del /a /f /s /q "%SystemRoot%\*._mp"

del /a /f /s /q "%SystemRoot%\*.bak"

attrib -r -a -s -h "%systemdrive%\*.log" /d /s>nul 2>nul
del /a /f /s /q "%systemdrive%\*.log"

del /a /f /s /q "%SystemRoot%\*.dmp"
del /a /f /s /q "%SystemRoot%\*.gid"
del /a /f /s /q "%SystemRoot%\*.old"
del /a /f /s /q "%SystemRoot%\*.query"
del /a /f /q "%SystemRoot%\*.tmp"
rd /s /q "%SystemRoot%\Downloaded Program Files"
rd /s /q "%SystemRoot%\Offline Web Pages"
rd /s /q "%systemroot%\Connection Wizard"
rd /s /q "%SystemRoot%\SoftwareDistribution\Download"
rd /s /q "%SystemRoot%\Assembly"

rem 想删除帮助文件就把前面的下面的rem 去掉
rem rd /s /q "%SystemRoot%\Help"

rd /s /q "%SystemRoot%\ReinstallBackups"
del /a /s /q "%SystemRoot%\inf\*.pnf"
del /a /f /s /q "%SystemRoot%\inf\InfCache.1"

rem 注意下面这段可能会清掉不该清掉的东西(我感觉就是这里),怕出问题建议 rem 下面这几句!
rem 我已经将其注释掉了,研究清楚了为什么误删有用的东西后再去掉rem吧!请搞清楚了的来这说一下。
rem dir %SystemRoot%\inf\*.* /ad/b >%SystemRoot%\vTmp.txt
rem for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemRoot%\inf\%%a"
rem del /a /f /s /q "%SystemRoot%\drive

r?\*.pnf"
rem del /a /f /s /q "%SystemRoot%\driver?\InfCache.1"
rem del /a /f /s /q "%SystemDrive%\driver?\*.pnf"
rem del /a /f /s /q "%SystemDrive%\driver?\InfCache.1"


rd /s /q "%SystemRoot%\temp" & md "%SystemRoot%\temp"
del /a /f /s /q "%SystemRoot%\Prefetch\*.*"
del /a /f /s /q "%SystemRoot%\minidump\*.*"


echo 正在清除无用的磁盘检错文件 (系统分区)……
del /a /f /q "%SystemDrive%\*.chk"
dir %SystemDrive%\found.??? /ad /b >%SystemRoot%\vTmp.txt
for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemDrive%\%%a"


echo 正在清理系统升级补丁留下来的反安装目录 (已修正能正确清除)……
dir %SystemRoot%\$*$ /ad/b >%SystemRoot%\vTmp.txt
for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemRoot%\%%a"


rem 可根据自己安装的软件及位置,依样修改,如添加各类播放器的缓存清理
rem 可按如下方式添加
rem 先结束可能正在运行的进程,如 taskkill /f /im "进程名.exe" /t
rem 静默删除该程序的缓存或临时文件,例如:
rem del /a /f /s /q "%ProgramFiles%\程序路径\*.tmp"

echo 正在清除常见的软件垃圾项目 (按默认目录,若没安装相应软件则不会删除什么项目)……
rd /s /q "%ProgramFiles%\InstallShield Installation Information"
Ren "%ProgramFiles%\Common~1\Real\Update_OB\realsched.exe" realsched.ex_
Del "%ProgramFiles%\Common~1\Real\Update_OB\realsched.exe"
Reg Delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v TkBellExe /f
rd /s /q "%ProgramFiles%\Tencent\QQGame\Download"
taskkill /f /im "TIMPlatform.exe" /t
del /a /f /s /q "%ProgramFiles%\Tencent\QQ\TIMPlatform.exe"
del /a /f /s /q "%ProgramFiles%\Kaspersky Lab\*.tmp"
echo.
echo 全部清理完毕,任意键退出
pause >nul
exit



--------------------------------------------------------------------------------






一键清理 64位

(可用于Windows7 x64、win 2008 r2等64位系统)

注意其间夹杂的 rem 项,rem表注释,注释了可以自定义或可选的项目或可能出错的项目

复制下面内容保存为 x64系统垃圾清理.bat



--------------------------------------------------------------------------------


@echo off
color 2f
title 64位系统通用垃圾文件清理器
@ ECHO.
@ ECHO.
@ ECHO 说 明
@ ECHO -----------------------------------------------------------------------
@ ECHO IT之家出品。它会帮您删除回收站、临时目录、最近打开过的文档痕迹等。
@ ECHO 对系统运行稍有帮助。如果您嫌电脑运行速度慢,不要指望用本批处理能搞好。
@ ECHO 电脑速度慢通常是因为太多无用的运算占据了CPU和内存资源所致。
@ ECHO 建议每隔一段时间,用Ghost恢复系统。这是最彻底的办法。
@ ECHO -----------------------------------------------------------------------
@ ECHO 本程序特点
@ ECHO -

----------------------------------------------------------------------
@ ECHO 鉴于很多人把IE缓存等文件夹转移到非系统盘,
@ ECHO 本程序清理垃圾文件时,首先进行判断系统的设置。
@ ECHO 优点:清理位置更加准确,策略更加科学。
@ ECHO 2009-12-04:高级菜鸟针对win7 X64 进行了校对并进行了修改。

@ ECHO 此批处理清理有些过分,请慎用,建议用作“二次开发”时的参考
@ ECHO -----------------------------------------------------------------------
@ ECHO 共享无售后,后果自承担,清理有风险,使用当谨慎
@ ECHO -----------------------------------------------------------------------
@ ECHO.
echo 确认清理吗?直接关闭窗口退出,按任意键开始清理
pause >nul

@echo off
echo.
echo ***** 系统垃圾文件清理器 *****
echo.
echo.
echo 开始执行清理……
echo.
echo 正在检查cookies、历史纪录等目录位置(当前用户)……
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cookies>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v History>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v NetHood>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Recent>>%temp%\cleantmp.txt
echo 正在清理Cookies、IE缓存、历史纪录等(当前用户)……
for /f "tokens=3*" %%a in (%temp%\cleantmp.txt) do (
for /d %%i in ("%%a %%b\*.*") do rd /s /q "%%i"
del /a /f /s /q "%%a %%b\*.*"
)

rem 跟上面几项未必是重复的,也是针对当前用户目录
echo 正在清理临时文件 (系统目录)……
del /a /f /s /q "%userprofile%\Locals~1\Tempor~1\*.*"
del /a /f /s /q "%userprofile%\Locals~1\Temp\*.*"

attrib -r -a -s -h "%userprofile%\cookies\*.*" /d /s>nul 2>nul
del /a /f /s /q "%userprofile%\cookies\*.*"

attrib -r -a -s -h "%userprofile%\recent\*.*" /d /s>nul 2>nul
del /a /f /s /q "%userprofile%\recent\*.*"

del /a /f /s /q "%Temp%\*.*"
del /a /f /s /q "%Tmp%\*.*"
del /a /f /s /q "%HomePath%\..\IconCache.db"


echo 正在清理系统目录中的垃圾文件 (稍候,需要点时间)……
del /a /f /s /q "%SystemRoot%\*._mp"

del /a /f /s /q "%SystemRoot%\*.bak"

attrib -r -a -s -h "%systemdrive%\*.log" /d /s>nul 2>nul
del /a /f /s /q "%systemdrive%\*.log"

del /a /f /s /q "%SystemRoot%\*.dmp"
del /a /f /s /q "%SystemRoot%\*.gid"
del /a /f /s /q "%SystemRoot%\*.old"
del /a /f /s /q "%SystemRoot%\*.query"
del /a /f /q "%SystemRoot%\*.tmp"
rd /s /q "%SystemRoot%\Downloaded Program Files"
rd /s /q "%SystemRoot%\Offline Web Pages"
rd /s /q "%systemroot%\Connection Wizard"
rd /s /q "%SystemRoot%\SoftwareDistribution\Download"
rd

/s /q "%SystemRoot%\Assembly"

rem 想删除帮助文件就把前面的下面的rem 去掉
rem rd /s /q "%SystemRoot%\Help"

rem 以下清理内容的安全性有待考证,特别是服务器版系统

rd /s /q "%SystemRoot%\ReinstallBackups"
del /a /s /q "%SystemRoot%\inf\*.pnf"
del /a /f /s /q "%SystemRoot%\inf\InfCache.1"

rem 注意下面这段可能会清掉不该清掉的东西(我感觉就是这里),怕出问题建议 rem 下面这几句!
rem 我已经将其注释掉了,研究清楚了为什么误删有用的东西后再去掉rem吧!请搞清楚了的来这说一下。
rem dir %SystemRoot%\inf\*.* /ad/b >%SystemRoot%\vTmp.txt
rem for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemRoot%\inf\%%a"
rem del /a /f /s /q "%SystemRoot%\driver?\*.pnf"
rem del /a /f /s /q "%SystemRoot%\driver?\InfCache.1"
rem del /a /f /s /q "%SystemDrive%\driver?\*.pnf"
rem del /a /f /s /q "%SystemDrive%\driver?\InfCache.1"


rd /s /q "%SystemRoot%\temp" & md "%SystemRoot%\temp"
del /a /f /s /q "%SystemRoot%\Prefetch\*.*"
del /a /f /s /q "%SystemRoot%\minidump\*.*"


echo 正在清除无用的磁盘检错文件 (系统分区)……
del /a /f /q "%SystemDrive%\*.chk"
dir %SystemDrive%\found.??? /ad /b >%SystemRoot%\vTmp.txt
for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemDrive%\%%a"


echo 正在清理系统升级补丁留下来的反安装目录 (已修正能正确清除)……
dir %SystemRoot%\$*$ /ad/b >%SystemRoot%\vTmp.txt
for /f %%a in (%SystemRoot%\vTmp.txt) do rd /s /q "%SystemRoot%\%%a"


rem 可根据自己安装的软件及位置,依样修改,如添加各类播放器的缓存清理
rem 64位软件的ProgramFiles目录清理,可按如下方式添加
rem 先结束可能正在运行的进程,如 taskkill /f /im "进程名.exe" /t
rem 静默删除该程序的缓存或临时文件,例如:
rem del /a /f /s /q "%ProgramFiles%\程序路径\*.tmp"

echo 正在清除常见的软件垃圾项目 (按默认目录,若没安装相应软件则不会删除什么项目)……
rd /s /q "%ProgramFiles(x86)%\InstallShield Installation Information"
Ren "%ProgramFiles(x86)%\Common~1\Real\Update_OB\realsched.exe" realsched.ex_
Del "%ProgramFiles(x86)%\Common~1\Real\Update_OB\realsched.exe"
Reg Delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v TkBellExe /f
rd /s /q "%ProgramFiles(x86)%\Tencent\QQGame\Download"
taskkill /f /im "TIMPlatform.exe" /t
del /a /f /s /q "%ProgramFiles(x86)%\Tencent\QQ\TIMPlatform.exe"
del /a /f /s /q "%ProgramFiles(x86)%\Kaspersky Lab\*.tmp"
echo.

rem %SystemRoot%与%windir%
rem del /f /s /q %systemdrive%的/s表包括子目录,故包含%SystemRoot%


echo 全部清理完毕,任意键退出
pause >nul
exit


相关主题