Pegasus [MVP] wrote:
> NoSpam wrote ...
>
>> All those not currently open, that is. The Windows registry defines
>> an Temp files folder. Windows and many apps place temp files in this
>> folder. However, on my system, there are 14 other folders with the
>> name Temp or Temporary. Many of these are in the Windows directory
>> tree and in the Documents and Settings tree. In addition, there are
>> files with the extensions .tmp and .temp here & there in the Windows
>> tree.
>>
>> Is there a utility that will clean up ALL temp files rather than
>> just allowing them to collect?
>
> You could use the Task Scheduler to run the following batch file at
> boot time under an Administrator account:
>
> @echo off del /s /q /f c:\*.tmp
>
> Is it safe? Well, by universal agreement everyone uses .tmp files for
> temporary storage. I have never seen an exception to this convention.
Except I've seen install programs that rely on some files in the user
profile %temp% (and sometimes but rarely in the %windir%\temp)
folder for after a requried reboot to then continue the installation or
some cleanup after the installation. Rather than schedule the .bat to
run at Windows startup or on logon, schedule it for a time when you
won't be using the computer, like 3AM in the morning, provided it
doesn't overlap any other scheduled events on your host. If the host is
normally powered off at that time, enable the option in the event to
power up the host. If you don't want the host left powered up, add the
shutdown command to the .bat file. Or just put a shortcut to the .bat
file in a Taskbar toolbar and click on it whenever you feel the need to
purge.
There are also many programs that use the temp folders to store their
log files. Some store their 'lock' files there (used to regulate
process or file access control). In fact, you'll probably find several
files in your %temp% folder and perhaps some in the %windir%\temp folder
that you cannot delete because they still have an open file handle
(i.e., they are inuse).
That there are several "Temp[orary]" folders under the userprofile path
means they are likely under *different* user profile folders. That
means this user logging onto their Windows account will NOT be able to
clean up the temp folders under the other accounts due to privilege
restrictions - unless they are logging in under an admin-level account.
The OP didn't mention if they always use an admin-level account.
However, if these temp files are under accounts for other user's profile
then THEY should be doing their own cleanup and not having an admin yank
the files from under them and probably without the permission and
probably without giving any warning.
Probably safer would be to use the CCleaner utility (it's free).
Besides running it interactively, you could run it as a scheduled event
on logon. It has an '/auto' command-line parameter to run without
showing its GUI (i.e., silently run) along with a user configurable
option to leave temp files that were created within the last 24 hours.
http://www.piriform.com/ccleaner