China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-10 08:59
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] 30-second System Junk Cleanup View 3,513 Replies 8
Original Poster Posted 2008-11-11 15:24 ·  中国 重庆 联通
中级用户
★★
Credits 363
Posts 162
Joined 2007-04-22 21:31
19-year member
UID 86104
Gender Male
Status Offline
I believe many netizens have this kind of batch processing in their computers. The ones found online are generally just a few lines. The one I wrote cleans more comprehensively. There is an attachment, which can be downloaded directly.

Function:
Empty the recycle bin of all hard disk partitions.
Delete *.tmp *._mp *.gid *.chk *.old in the system partition.
Delete *.log *.bak in the WINDOWS directory.
Empty the system garbage storage directory "%windir%\prefetch\*".
Empty cookies.
Clear the recently opened file records.
Empty the WINDOWS temporary directory.
Clear the redundant system startup items (only keep the input method CTFMON).
Clear the IE internet temporary files.
Clear the system TEMP files.
Clear the usage records of the start menu.
Clear the usage records of "Run", "Search", etc.

@echo off
color 2f
title System Junk Cleanup clamber 2008/11/11 CMD@XP 282959030@qq.com
echo.&echo Welcome to use System Junk Cleanup!&echo.&echo Cleanup targets: redundant system startup items; empty recycle bin; IE temporary files; system temporary directory;&echo System history records; system junk files...
echo.&echo Press any key to confirm immediate cleanup!&pause>nul
title Get IE and system temporary folder directories and clean up
for /f "tokens=1,2* delims=:" %%a in ('reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\paths" /v Directory^|find "Directory"') do (set qian=%%a&&set hou=%%~pb)
rd /s /q "%qian:~-1,1%:%hou%" 2>nul
rd /s /q "%temp%" 2>nul
title Get hard disk partition letters and clean up recycle bins of each partition
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "Fixed">nul && (
rd /s /q !drive!\RECYCLER 2>nul||rd /s /q !drive!\Recycled 2>nul
)
)
endlocal
title Cleanup STARTUP startup items
del /f /q "%USERPROFILE%\「Start」Menu\Programs\Startup\*" 2>nul
title Cleanup system search history and registry startup items
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /va /f 2>nul
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /va /f 2>nul
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Search Assistant\ACMru\5603" /va /f 2>nul
reg delete "HKEY_USERS\S-1-5-21-299502267-854245398-682003330-500\Software\Microsoft\Search Assistant\ACMru\5603" /va /f 2>nul
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /va /f 2>nul
reg delete HKEY_USERS\S-1-5-21-299502267-854245398-682003330-500\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /va /f 2>nul
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count /va /f 2>nul
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{5E6AB780-7743-11CF-A12B-00AA004AE837}\Count /va /f 2>nul
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v ctfmon.exe /d %systemdrive%\WINDOWS\system32\ctfmon.exe /f 2>nul
title Clear system temporary and useless files
del /f /s /q "%systemdrive%\*.tmp" 2>nul
del /f /s /q "%systemdrive%\*._mp" 2>nul
del /f /s /q "%windir%\*.log" 2>nul
del /f /s /q "%systemdrive%\*.gid" 2>nul
del /f /s /q "%systemdrive%\*.chk" 2>nul
del /f /s /q "%systemdrive%\*.old" 2>nul
del /f /s /q "%windir%\*.bak" 2>nul
del /f /s /q "%windir%\prefetch\*" 2>nul
rd /s /q "%windir%\temp"&&md "%windir%\temp" 2>nul
del /f /q "%userprofile%\cookies\*" 2>nul
del /f /q "%userprofile%\recent\*" 2>nul
del /f /s /q "%userprofile%\recent\*" 2>nul
color 5e
title Cleanup completed!
echo Cleanup completed! Press any key to exit...
pause>nul&taskkill /f /im explorer.exe&start explorer.exe


[ Last edited by clian76 on 2008-11-11 at 18:40 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
yishanju -4 2008-11-11 18:44
Attachments
系统垃圾文件清理.rar (1.26 KiB, Downloads: 85)
Floor 2 Posted 2008-11-11 15:29 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
I'm really annoyed when people in the company use these scripts. After they use them and something unexpected happens, then I've got work to do. I want to bite anyone who sends these scripts.

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 3 Posted 2008-11-11 16:36 ·  中国 湖南 长沙 联通
新手上路
Credits 1
Posts 1
Joined 2008-11-11 16:14
17-year member
UID 130660
Gender Male
Status Offline
Thanks for sharing
Floor 4 Posted 2008-11-11 17:28 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Reference: Deleting system junk with batch processing is actually junk itself
http://user.qzone.qq.com/276902008/blog/1216130288
Floor 5 Posted 2008-11-11 17:31 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
Kaka, HAT has also started promoting QQ Space.

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
Floor 6 Posted 2008-11-11 17:36 ·  中国 重庆 联通
中级用户
★★
Credits 363
Posts 162
Joined 2007-04-22 21:31
19-year member
UID 86104
Gender Male
Status Offline
What Boss HAT said is indeed an issue. I've only encountered the situation of mistakenly deleting LOG files, so here I only clear the LOG files in the %WINDIR% folder, which has no impact on the uninstaller. This P processing is to clean up traces and junk files, so its function has been achieved : )
Floor 7 Posted 2008-11-11 17:51 ·  中国 天津 武清区 联通
初级用户
Credits 41
Posts 28
Joined 2008-08-19 13:19
17-year member
UID 123578
Gender Male
Status Offline
This one seems to have more content than the others.
Floor 8 Posted 2008-11-11 18:11 ·  中国 广西 桂林 电信
初级用户
Credits 26
Posts 14
Joined 2008-07-06 22:26
18-year member
UID 121182
Status Offline
This type of batch processing is still better to write for yourself according to your own actual situation.
Floor 9 Posted 2008-11-11 18:38 ·  中国 重庆 联通
中级用户
★★
Credits 363
Posts 162
Joined 2007-04-22 21:31
19-year member
UID 86104
Gender Male
Status Offline
Originally posted by pigpigs at 2008-11-11 05:51 PM:
This one seems to be more comprehensive than others in terms of content.

Clear all hard disk partition recycling bins.
Delete *.tmp *._mp *.gid *.chk *.old in the system partition.
Delete *.log *.bak in the WINDOWS directory.
Empty the system junk storage directory "%windir%\prefetch\*".
Empty cookies.
Clear the recent opened file records.
Empty the WINDOWS temporary directory.
Clear the redundant system startup items (leave only the input method CTFMON).
Clear the IE internet temporary files.
Clear the system TEMP files.
Clear the usage records in the Start menu.
Clear the usage records of "Run", "Search", etc.
Forum Jump: