Skip to content

Instantly share code, notes, and snippets.

@david082321
Forked from huobazi/Win7清除垃圾文件.bat
Last active September 28, 2017 13:28
Show Gist options
  • Save david082321/165a7109edc042ef83a41cab3806831a to your computer and use it in GitHub Desktop.
Save david082321/165a7109edc042ef83a41cab3806831a to your computer and use it in GitHub Desktop.
Win7清除垃圾文件.bat
@echo off
echo 清空IE临时文件目录...
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
echo 正在清除系统临时文件 *.tmp *._tmp *.log *.chk *.old ,请稍等...
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
echo 清空垃圾箱,备份文件和预缓存脚本...
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
rem cooke和最近历史还是保留吧...
rem del /f /q %userprofile%\COOKIES s\*.*
rem del /f /q %userprofile%\recent\*.*
echo 清理系统盘无用文件...
%windir%\system32\sfc.exe /purgecache
echo 优化预读信息...
%windir%\system32\defrag.exe %systemdrive% -b
echo 清除系统完成!
echo. & pause
@echo off
color 0a
title windows7系統垃圾清理---
echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★
echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★
echo.★☆ ☆★
echo.★☆ ☆★
echo.★☆ 清理系統垃圾文件,請稍等...... ☆★
echo ★☆ ☆★
echo.★☆ ☆★
echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★
echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★
echo 清理垃圾文件,速度由電腦文件大小而定。在沒看到結尾信息時
echo 請勿關閉本窗口。
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 ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
echo ★☆ ☆★
echo.★☆ ☆★
echo.★☆ ☆★
echo ★☆ ☆★
echo ★☆ 恭喜您!清理全部完成! ☆★
echo.★☆ ☆★
echo ★☆ ☆★
echo.★☆ ☆★
echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
echo.
@echo off
  echo 正在清除系统垃圾文件,请稍等......
  del /f /s /q %systemdrive%\*.tmp
  del /f /s /q %systemdrive%\*._mp
  del /f /s /q %systemdrive%\*.gid
  del /f /s /q %systemdrive%\*.chk
  del /f /s /q %systemdrive%\*.old
  del /f /s /q %systemdrive%\recycled\*.*
  del /f /s /q %windir%\*.bak
  del /f /s /q %windir%\prefetch\*.*
  rd /s /q %windir%\temp & md %windir%\temp
  del /f /q %userprofile%\cookies\*.*
  del /f /q %userprofile%\recent\*.*
  del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
  del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
  del /f /s /q "%userprofile%\recent\*.*"
cls
del %systemroot%\prefetch\*.* /q
cls
echo 清除系统LJ完成!
  echo. & pause
@echo off
rd "%appdata%/microsoft/Credentials" /q /s
rd "%appdata%/microsoft/Protect" /q /s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment