Jump to content

Adding modules to cleanmgr.exe


Recommended Posts

I recently discovered that new items can be added to Windows' Disk Clean up utility (cleanmgr.exe) by simply adding a registry key with appropriate values. B) The details are buried at Creating a Disk Cleanup Handler.I used term buried because the vast bulk of page is concerned with writing a new cleanup handler from scratch. Skip that and look for the - two paragraph long - "Using the DataDrivenCleaner Object" section near the bottom of the page. Then study the table of registry values that proceeds it.Here are a few examples to show just how easy this is. (Copy and paste into notepad. Save as a .reg file. Then double click on the file.)Remove seldom used items from Windows Prefetch

Windows Registry Editor Version 5.00 ; Remove seldom used items from Windows Prefetch [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Trim Prefetch]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""Display"="Trim Prefetch""Description"="Trims items from prefetch which haven't been used in the last 3 weeks""FileList"="*.pf" ; Only prefetch files will be deleted. "CSIDL"=dword:00000024 ; dword:00000024 corresponds to the %SYSTEMROOT% folder "Folder"="Prefetch" ; The CSIDL and Folder entries get combined; on most systems CSIDL + FOLDER = C:\Windows\Prefetch "LastAccess"=dword:00000015 ; Ignore files that have been accessed within the last three weeks.; Prefetch is suppose to be for frequently used items.; If we haven't used the item in over three weeks, it may not make sense to prefetch it. "StateFlags0000"=dword:00000002"StateFlags"=dword:00000000
Clean %windir%\Temp which XP's Disk Cleanup normally leaves untouched.
Windows Registry Editor Version 5.00 ; Cleans %windir%\Temp which XP's Disk Cleanup normally leaves untouched. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\SYSTEMROOT_TEMP Folder]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""Display"="SYSTEMROOT Temporary files""Description"="Delete files and folders found the TEMP folder located in the %SYSTEMROOT% folder""FileList"="*.*""CSIDL"=dword:00000024 ; dword:00000024 corresponds to the %SYSTEMROOT% folder "Folder"="Temp" ; on most systems CSIDL + FOLDER = C:\Windows\TEMP "Flags"=dword:00000041 ;0x00000001 Search and remove recursively.;0x00000040 Match the FileList value against directories and remove matches and all of their subdirectories. "LastAccess"=dword:00000007 ; 7 days must have elapsed since a file was last accessed or a directory was created before; that file/directory will be considered for cleanup. "StateFlags0000"=dword:00000002"StateFlags"=dword:00000000
More through cleanup for Win98
REGEDIT4  ; CAUTION: On some systems Internet Explorer's temporary Internet files are located;          inside this folder. If you want to preserve those files, choose a different;          location for them in Control Panel> Internet Options before using this module. ; Throughly cleans Windows TEMP folder. [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\VolumeCaches\Temporary files (Complete)]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""display"="Temporary files (Complete)""description"="(Revised - through cleanup.) Programs sometimes store temporary information in a TEMP folder. Before a program closes, it usually deletes this information. You can safely delete temporary files that have not been modified in over a week.""filelist"="*.*""flags"=dword:00000041 ;0x00000001 Search and remove recursively.;0x00000040 Match the FileList value against directories and remove matches and all of their subdirectories. "folder"="C:\\WINDOWS\\TEMP\\" ;Edit above location to match your system.;"folder"="%WINDIR%\\TEMP" may work but hasn't been tested. "lastaccess"=dword:00000007"StateFlags"=dword:00000001"StateFlags0000"=dword:00000002
  • Like 1
Link to comment
Share on other sites

I emailed Fred the info before posting it to this forum. :)I don't currently have a Windows 98 system to test on. And I have some doubts about the CSIDL parameter working on such systems. If it does work, the following modules could be made more general.FWIW here are four modules that could replace Fred's basic Cleanup.bat file on Win98/ME or WinXP with the indicated edits.

REGEDIT4[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\VolumeCaches\Basic Cleanup A]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""Description"="Deletes ALL files in c:\Windows\temp; C:\temp; c:\windows\tmp and c:\tmp. Freg Langa's basic Cleanup.bat deletes these folders and their contents. Here only the contents are deleted.""Display"="Basic Cleanup A""FileList"="*.*""Folder"="c:\\windows\\temp|c:\\temp|c:\\windows\\tmp|c:\\tmp"; Edit the above line as necessary.[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\VolumeCaches\Basic Cleanup B]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""Description"="Deletes some large, possibly 'orphan' files from the 'Temporary Internet Files' folder.""Display"="Basic Cleanup b""Folder"="c:\\windows\\Temporary Internet Files"; The previous line is for standard Windows 9x and may need to be edited.; for a windows XP system the above line might look something like; "Folder"="c:\\documents and settings\\YOUR_USER_NAME\\local settings\\temporary internet files""FileList"="*.asf|*.avi|*.bmp|*.exe|*.gif|*.jpg|*.mov|*.mp3|*.mpg|*.mpeg|*.png|*.qt|*.ra|*.ram|*.zip"[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\VolumeCaches\Basic Cleanup C]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""Description"="Deletes garbage files that office leaves behind in c:\windows""Display"="Basic Cleanup C""Folder"="c:\\windows"; It would probably be better to replace the above line with; "CSIDL"=dword:00000024; which corresponds with the %windir% variable."FileList"="ff*.tmp"[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\VolumeCaches\Basic Cleanup D]@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}""Description"="Erases the icon cache""Display"="Basic Cleanup D""Folder"="C:\\Windows\\ShellIconCache""FileList"="*.*; For Windows XP systems the above two lines MUST BE REPLACED WITH THE FOLLOWING TWO LINES; "CSIDL"=dword:0000001a; "FileList"="IconCache.db"
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...