这里给出一个清理电脑运行过程中的垃圾以及部分使用痕迹的小程序、每天关机前运行一下就可以保持电脑"干净"、不会因为长久使用造成系统变慢。
这个程序将清理垃圾、并在清理完毕之后等待30秒后自动关机,所以你不必等待清理完毕之后去手动关机。
将以下给出的代码另存为 清除系统垃圾.bat 的文件就可得到可以运行的程序、注意后缀.bat。
其中有两处需要你注意:
1.0
首先是最后一句代码: shutdown -s -t 30 -f
这句代码的意思是: 强制关闭所有打开的程序、并等待30秒后关机、时间的参数就是30(单位是秒)、你可以自定义。
之所以等待30秒、是因为你有时可能不想关机,所以预留30秒的机会给你。取消关机的命令是: shutdowm -a、将shutdowm-a输入"运行"窗口、按下ENTER即可。
你可以在"运行"窗口中输入shutdown -s -t 30 -f、按下ENTER以观看他的效果,然后将shutdowm-a输入"运行"窗口、按下ENTER观看取消的效果。
快速打开"运行"窗口的快捷键是:"徽标键+R",在取消的时候输入代码将使你明白30秒的意义,当然如果你不喜欢代码、你可以将shutdown-a单独保存为一个.bat文件、专门用来取消关机。
如果你不需要、直接删除这条代码即可。
2.0
然后是第二句: start "" "%appdata%microsoftinternet explorerquicklaunch显示桌面.scf"
意思是将所有窗口最小化、显示桌面,这样可以防止清理垃圾程序的窗口处于最前面、处在最前面可能由于某些原因使得清理过程暂停。
如果你不需要、直接删除这条代码即可。
完整代码:
@echo off
start "" "%appdata%microsoftinternet explorerquicklaunch显示桌面.scf"
color 0A
title 历史痕迹兼系统垃圾清理 beta1.0
::全盘删除Thumbs.db(缩略图缓存文件)
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in ('fsutil fsinfo drives^|find ""') do(
set drive_=%%i
fsutil fsinfo drivetype !drive_:~0,2!|find "固定">nul&& del /a /f /q /s !drive_:~0,2!Thumbs.db
)
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%*.tmp
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 SettingsTemporary InternetFiles*.*"
del /f /s /q "%userprofile%Local SettingsTemp*.*"
del /f /s /q "%userprofile%recent*.*"
del /f /q "%ALLUSERSPROFILE%DocumentsDrWatson*.*">nul2>nul
del /f /q "%USERPROFILE%ApplicationDataMicrosoftOfficeRecent*.lnk">nul 2>nul
::清理局域网共享痕迹
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerWorkgroupCrawlerShares"/f >nul 2>nul
::用户运行或操作历史记录
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocsFolder"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.txt"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.rar"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.mp3"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.jpg"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.ini"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.bmp"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.doc"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.eip"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.htm"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.ico"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.inf"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.gif"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.wav"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.xls"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs.rm"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32LastVisitedMRU"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRU*"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUmp3"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUrm"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUwav"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUbat"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUexe"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUeip"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUico"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUhtm"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSaveMRUjpg"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRunMRU"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerStreamMRU"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist{5E6AB780-7743-11CF-A12B-00AA004AE837}Count"/va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist{75048700-EF1F-11D0-9888-006097DEACF9}Count"/va /f >nul 2>nul
reg delete "HKCUSoftwareWinRARArcHistory" /va /f >nul2>nul
reg delete "HKCUSoftwareWinRARDialogEditHistoryArcName" /va/f >nul 2>nul
reg delete "HKCUSoftwareWinRARDialogEditHistoryExtrPath" /va/f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftMediaPlayerPlayerRecent FileList" /va /f>nul 2>nul
reg delete "HKCUSoftwareMicrosoftMicrosoft ManagementConsoleRecent File List" /va /f >nul 2>nul
reg delete"HKCUSoftwareMicrosoftOffice11.0PowerPointRecent File List"/va /f >nul 2>nul
reg delete "HKCUSoftwareMicrosoftOffice11.0ExcelRecentFile" /va /f >nul 2>nul
reg delete "HKCUSoftwareMicrosoftOffice11.0WordData" /v"Settings" /f >nul 2>nul
reg delete "HKCUSoftwareVMware, Inc." /va /f >nul2>nul
::清理IE浏览历史的下拉列表
reg delete "HKCUSoftwareMicrosoftInternet ExplorerTypedUrls"/va /f >nul 2>nul
echo-----------------------------------------------------------------------------
shutdown -s -t 30 -f