随着windows 7越来越流行,xp又是那么舍不得放的朋友,而以前的xp清理垃圾批处理是那么的好用,直接放到win 7上又会出问题,现windows 8又出来了,跟windows 多了些东西,于是今天我手写了一个批处理,解决了以前网页临时文件清不到,搞了这么多年,总不见有人出来改进下,骗了人家用的人多年呀。今天我一起改了一下,目前此批处理会自动选择系统,支持版本号为5.开头的,如xp版本是5.1 win 7是6.1 win8 是6.2 这个系统所以win 8 也可以用这个程,原来2000 2003这些都可以用。你只需要把下面代码自制到记事本里面,改名为,清理垃圾.bat文件即可:
@echo off
color 08
title DigUp (system Garbage Clean up)
echo.
echo. Is to clean common system junk,please wait�K
echo.
dir %windir%\$NtUninstall* /a:d /b >%windir%\Patches.txt
for /f %%i in (%windir%\Patches.txt) do rd /s /q %windir%\%%i
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 %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
del /f /s /q %windir%\temp\*.*
del /f /s /q %windir%\Patches.txt
cls
rem Judgment OS Version
ver|find "5." >nul &&goto x
ver|find "6." >nul &&goto 7
cls
echo.
echo. Clean-up completed
ping -n 5 127.0.0.1>nul
:x
rem xp
color 8a
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q "%userprofile%\cookies\*.*"
del /f /s /q "%userprofile%\recent\*.*"
rd /s /q "%userprofile%\Local Settings\Temporary Internet Files" & md "%userprofile%\Local Settings\Temporary Internet Files"
rd /s /q %windir%\temp & md %windir%\temp & md %windir%\temp & md %windir%\temp
rd /s /q "%userprofile%\Local Settings\History" & md "%userprofile%\Local Settings\History"
rd /s /q "%userprofile%\Local Settings\temp" & md "%userprofile%\Local Settings\temp"
cls
echo.
echo. Clean-up completed
ping -n 5 127.0.0.1>nul
exit
:7
color 72
rem win 7
del /f /s /q %systemdrive%\$recycle.bin\*.*
del /f /s /q "%userprofile%\AppData\Roaming\Microsoft\Windows\Cookies\*.*"
del /f /s /q "%userprofile%\AppData\Roaming\Microsoft\Windows\Recent\*.*"
rd /s /q "%userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files" & md "%userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files"
rd /s /q "%userprofile%\AppData\Local\Temp" & md "%userprofile%\AppData\Local\Temp"
rd /s /q "%userprofile%\AppData\Local\Microsoft\Windows\History" & md "%userprofile%\AppData\Local\Microsoft\Windows\History"
cls
echo.
ver|find "6.2" >nul &&goto 8
echo. Clean-up completed
ping -n 5 127.0.0.1>nul
exit
:8
color 7c
rem Clear up Modern
:: 此条不稳定rd /s /q "%userprofile%\AppData\Local\Packages" & md "%userprofile%\AppData\Local\Packages"
echo. Clean-up completed
ping -n 5 127.0.0.1>nul
exit