清除系统垃圾.bat
rem @echo off
call :getDriveFree
set 释放前空间=%剩余空间m%
echo 保存为*.bat文件 即可执行
echo 正在清除系统垃圾文件,请稍等......
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
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/*.*"
echo 清除系统垃圾完成!
call :getDriveFree
set 释放后空间=%剩余空间m%
cls
@echo off
echo 释放前空间:%释放前空间%
echo 释放后空间:%释放后空间%
set /a 释放空间=释放后空间-释放前空间
echo 释放空间为:%释放空间%
pause
rem 磁盘剩余空间--------------------------------------------------------------------
:getDriveFree
cd /d %盘符%
FOR /F "usebackq tokens=3,4*" %%i IN (`dir /W /-C`) DO call :show %%i
set 剩余空间M=%剩余空间%
if %剩余空间% GEQ 10240 call :format 1024 K
if %剩余空间% GEQ 10485760 call :format 1048576 M
rem if %剩余空间% GEQ 10737418240 call :format 1073741824 G
goto :EOF
:show
set 剩余空间=%1
goto :EOF
rem 参数1 被除数 参数2 单位
:format
set /a tmpValue=剩余空间/%1
set 剩余空间M=%tmpValue%%2
goto :EOF
rem --------------------------------------------------------------------