The optimized version of the Bat file for cleaning up system junk is an automatic cleaning Bat based on the Internet. It is optimized for user usage habits. Students can copy the source code below to Notepad and change the extension to .bat, or they can download and use it directly. .
File description
This function fundamentally solves the problem of accidentally deleting files, so please feel free to use it. In addition to one-click cleaning of system junk files, it also adds IE temporary file management functions, which can easily delete IE temporary files and easily extract any temporary files. A powerful tool for cleaning up system junk files. No need to make any settings, you can delete unnecessary junk files in the system with just one click.
Code description
@ECHOON
color0A
@echooff
cls
echo.
echo*****System Junk File Cleaner*****
Title System Junk File Cleaner Qiba Producer: Xiaoyue Technical Support
echo is ready
echo.&pause
cls
echo.
echo starts to perform cleanup...
echo.
Echo is checking the directory location of cookies, history records, etc. (current user)...
regquery"HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShellFolders"Cache>%temp%cleantmp.txt
regquery"HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShellFolders"Cookies>>%temp%cleantmp.txt
regquery"HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShellFolders"History>>%temp%cleantmp.txt
regquery"HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShellFolders"NetHood>>%temp%cleantmp.txt
regquery"HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShellFolders"Recent>>%temp%cleantmp.txt
echo is clearing cookies, IE cache, history, etc. (current user)...
for/f"tokens=3*"%%ain(%temp%cleantmp.txt)do(
for/d%%iin("%%a%%b*.*")dord/s/q"%%i"
del/a/f/s/q"%%a%%b*.*"
)
colorf0
cls
::It may not be the same as the above items (!), it is also for the current user directory
Echo is cleaning up temporary files (system directory)...
del/a/f/s/q"%userprofile%Locals~1Tempor~1*.*"
del/a/f/s/q"%userprofile%Locals~1Temp*.*"
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"
rd/s/q%Temp%
rd/s/q%Tmp%
color0D
cls
Echo is cleaning up junk files in the system directory (wait, it will take some time)...
del/a/f/s/q"%SystemRoot%*._mp"
del/a/f/s/q"%SystemRoot%*.bak"
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%DownloadedProgramFiles"
rd/s/q"%SystemRoot%OfflineWebPages"
rd/s/q"%systemroot%ConnectionWizard"
rd/s/q"%SystemRoot%SoftwareDistributionDownload"
rd/s/q"%SystemRoot%Assembly"
rd/s/q"%SystemRoot%Help"
rd/s/q"%SystemRoot%ReinstallBackups"
del/a/s/q"%SystemRoot%inf*.pnf"
del/a/f/s/q"%SystemRoot%infInfCache.1"
dir%SystemRoot%inf*.*/ad/b>%SystemRoot%vTmp.txt
for/f%%ain(%SystemRoot%vTmp.txt)dord/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%temp"&md"%SystemRoot%temp"
del/a/f/s/q"%SystemRoot%Prefetch*.*"
del/a/f/s/q"%SystemRoot%minidump*.*"
color0c
cls
Echo is clearing useless disk error checking files (system partition)...
del/a/f/q"%SystemDrive%*.chk"
dir%SystemDrive%found.???/ad/b>%SystemRoot%vTmp.txt
for/f%%ain(%SystemRoot%vTmp.txt)dord/s/q"%SystemDrive%%%a"
echo is cleaning up the uninstallation directory left behind by the system upgrade patch (it has been corrected to clear it correctly)...
dir%SystemRoot%$*$/ad/b>%SystemRoot%vTmp.txt
for/f%%ain(%SystemRoot%vTmp.txt)dord/s/q"%SystemRoot%%%a"
color3d
cls
Echo is cleaning common software junk items (by default directory)...
rd/s/q"%ProgramFiles%InstallShieldInstallationInformation"
Ren"%ProgramFiles%Common~1RealUpdate_OBrealsched.exe"realsched.ex_
Del"%ProgramFiles%Common~1RealUpdate_OBrealsched.exe"
RegDelete"HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun"TkBellExe/f
rd/s/q"%ProgramFiles%TencentQQGameDownload"
taskkill /f /im"TIMPlatform.exe"/t
del/a/f/s/q"%ProgramFiles%TencentQQTIMPlatform.exe"
del/a/f/s/q"%ProgramFiles%KasperskyLab*.tmp"
color9A
cls
echo.
The echo will automatically exit after 5 seconds of garbage cleaning. Producer: Xiaoyue Technical Support
echo.
ping127.1-n6>nul