今天我们来做一个批处理清理垃圾的程序,需要一台电脑和Windows7及以上系统。

打开​​notepad​​,输入代码如下:

@echo off
chcp 65001
title clean.
cls
:clean
color 0a
RD %windir%\$hf_mig$ /Q /S
dir %windir%\$NtUninstall* /a:d /b >%windir%\delsystem.txt
for /f %%i in (%windir%\delsystem.txt) do rd %windir%\%%i /s /q
del %windir%\delsystem.txt /f /q
del %windir%\KB*.log /f /q
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 /s /q "%userprofile%\local settings\temporary internet files\*.*"
del /f /s /q "%userprofile%\local settings\temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
cls
goto clean
pause

代码完成了!