08-16-2007, 08:43 AM
You can use Windows disk cleanup tool.
At first run this macro:
It does not delete any files but rather shows a dialog where you can select what files must be deleted when you run the second macro.
Then run this macro:
The second macro deletes files specified when you ran the first macro. It does not require user interaction, and therefore can run unattended, for example scheduled.
The settings you have made while you ran the first macro are associated with the number 100. It can be any number between 0 and 65535. For example, you can use number 100 to delete Temporary Internet Files, number 101 to delete Temporary Files and Recycle Bin, etc. Use the same number in both macros.
Note that you have to run macro1 only once (for each different number), unless you want to change settings. Then you can run macro2 multiple times, at any time.
The code in another post that deletes temp files works better than cleanmgr. It deletes all files that are not locked, while cleanmgr leaves many files if some files are locked.
Tested on XP and Vista.
At first run this macro:
It does not delete any files but rather shows a dialog where you can select what files must be deleted when you run the second macro.
Then run this macro:
The second macro deletes files specified when you ran the first macro. It does not require user interaction, and therefore can run unattended, for example scheduled.
The settings you have made while you ran the first macro are associated with the number 100. It can be any number between 0 and 65535. For example, you can use number 100 to delete Temporary Internet Files, number 101 to delete Temporary Files and Recycle Bin, etc. Use the same number in both macros.
Note that you have to run macro1 only once (for each different number), unless you want to change settings. Then you can run macro2 multiple times, at any time.
The code in another post that deletes temp files works better than cleanmgr. It deletes all files that are not locked, while cleanmgr leaves many files if some files are locked.
Tested on XP and Vista.