Delete Outlook 2010/2013 Temp Files on Boot

Steven Brady February 2, 2016
0 people like this post

I recently needed to have to delete both Outlook 2010 and 2013 temp files on boot in Windows 7 and 8. While not planning an in-depth tutorial, I’ve decided to put both the batch code here in case anyone else needs it. There’s one for each, and if the path isn’t found in the registry it shouldn’t run anything. But keep in mind that these commands delete entire directories, so use at your own risk. I run them back to back because of deployments of both versions of Office in our environment.

Outlook 2010

FOR /F “usebackq tokens=2,* skip=2” %%L IN (
     `reg query “HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security” /v OutlookSecureTempFolder`
) DO SET OutlookSecureTempFolder2010=%%M
if defined OutlookSecureTempFolder2010 (
     echo OutlookSecureTempFolder2010 = %OutlookSecureTempFolder2010%
     attrib %OutlookSecureTempFolder2010% -R /s
     del %OutlookSecureTempFolder2010% /s /q
     mkdir %OutlookSecureTempFolder2010%
) else (

Outlook 2013

FOR /F “usebackq tokens=2,* skip=2” %%L IN (
     `reg query “HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Security” /v OutlookSecureTempFolder`
) DO SET OutlookSecureTempFolder2013=%%M
if defined OutlookSecureTempFolder2013 (
     echo OutlookSecureTempFolder2013 = %OutlookSecureTempFolder2013%
     attrib %OutlookSecureTempFolder2013% -R /s
     del %OutlookSecureTempFolder2013% /s /q
     mkdir %OutlookSecureTempFolder2013%
) else (

Category: Geekery
  • 0
  • 74
Steven Brady

Steven is an intermediate Linux admin, aspiring Internet marketer, husband, uncle, Christian, and a fan of Linux, Android, and the Green Lantern.

Leave your comment