Scot’s Newsletter Forums

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Adding modules to cleanmgr.exe
rbdietz
post Dec 31 2004, 07:07 PM
Post #1


Message Mogul
*****

Group: Members
Posts: 423
Joined: 9-December 04
From: Somewhere in South Dakota
Member No.: 2,983



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. biggrin.gif 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
QUOTE
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.
QUOTE
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
QUOTE
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
Go to the top of the page
 
+Quote Post
Ed_P
post Dec 31 2004, 09:35 PM
Post #2


Discussion Deity
************

Group: Members
Posts: 3,012
Joined: 19-March 03
From: Western NY
Member No.: 98



hmm.gif Thanks rbdietz. smile.gif

It would be interesting if someone could develop an object or series of objects that parallel Fred Langa's batch Cleanup jobs.


--------------------
Go to the top of the page
 
+Quote Post
rbdietz
post Jan 1 2005, 12:08 PM
Post #3


Message Mogul
*****

Group: Members
Posts: 423
Joined: 9-December 04
From: Somewhere in South Dakota
Member No.: 2,983



I emailed Fred the info before posting it to this forum. smile.gif

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.

QUOTE
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|*.r
a|*.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"
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 9th February 2010 - 07:22 AM