Here is a very simple batch file that can be added to the network logon script in Active directory or simply in your startup folder in windows if you or your end users frequently run into this error:


@echo off
ECHO Deleting Outlook 2003 temporary files
cd %userprofile%/local settings/temporary internet files/olk*
if errorlevel 1 goto end
del *.* /s /f /q
:end
exit

Batch file available here. (right-click, save as)

This batch file will simply navigate to the current user’s temporary Outlook folder and delete all the files in the root and sub-folders. Just be careful you don’t miss the %userprofile% variable, otherwise that command will delete all the files that happen to be in the current folder which is probably just the root of the user profile.

Original post found here.

Update 1/6/2009:  Big thanks to Mark suggesting some error handling to make sure you don’t accidentally wipe the current directory if the change directory command doesn’t take place.  I’ve updated the code snippet and example batch file with his suggestions.