How-To

Automatically Clear Internet Explorer 9 or 10 Cache and History at Exit

Here’s how to clear browser cache, temp files, history, and cookies each time you close IE.

Update: Microsoft is discontinuing Internet Explorer on June 15th, 2020.

Today I’m going to show you how to clear browser cache, temp files, history, and cookies each time you close IE (Internet Explorer.) You can do this with most modern browsers including Firefox; however, in IE, it’s even easier. Here’s how you do it.

How-To Automatically Clear IE9 Temporary Files at Browser Close

Open Internet Explorer 7, click Tools, Internet Options

internet options

Click Advanced Tab, Scroll Down and Check the box Empty Temporary Internet Files folder when browser is closed

Click OK, and you’re DONE!

advanced options empty temp files

It’s also possible to remove all the Browser History Files, Cookies, Temp Files, etc. using one of the commands below:

Delete Temporary Internet Files:

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

Delete Cookies:

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

Delete History:

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

Delete Form Data:

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

Delete Passwords:

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

Delete All

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Delete All (Also delete files and settings stored by add-ons)

  • RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

Now, you can either run these commands from a CMD line, or from the Start, Start Search Run Box in Vista OR, even better from a Batch File.  The batch file is a nice touch because you can create it on your desktop and click on it at will, without having to remember the commands here from groovyPost.  Now I understand everyone knows how to set up a Batch File to execute code, but if you need help, take a look at my next article on how to create a Batch File to Delete IE7 Browser History and Temp Files.

6 Comments

6 Comments

  1. David M

    February 19, 2009 at 2:49 am

    Awesome. Been wanting to have a desktop click to remove cookies for ages. Leaves the BIG question why MS don’t incorporate this as an option in IE (delete cookies on exit).

    Thanks

  2. MrGroove

    February 22, 2009 at 11:31 am

    @David – I’m glad we had what you were looking for! Welcome to groovyPost and yes, I was curious about that also…. Would have been a lot easier if these were just check boxes to clear when you close the browser.

  3. Ramon

    July 13, 2010 at 7:44 am

    Greetings:

    Thanks for your post. Unfortunately I’ve tried this in IE 7 and while it does clear the temporary files upon exiting, the cookies still remain. The RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2 command works like a charm but I want it to make it easy for the users to clean the cookies without having to run/remember any other commands upon exiting IE 7. Any ideas?
    Thanks;
    Ramon

  4. Lar

    March 24, 2013 at 10:32 am

    Thanks for the info. Unfortunately, it does not appear IE 10 works the same way as previous versions.

    Having gone through all the options under Internet Options, there is a “Delete Browsing History on Exit” option, but the Settings section does not have anything to do with what is deleted.

    Strangely, there is a manual erase button which does allow you to choose what to immediately delete, but it does not appear to have anything to do with the automatic settings.

    The end result is I want to erase all cookies and cache when exiting, but not saved passwords and for data.

    Any suggestions?

  5. Arindam

    June 28, 2016 at 7:40 am

    Thank you very much

  6. Clint

    April 18, 2017 at 1:13 am

    I know this article is a few years old but I am hoping I can find out how to delete all user certificates in IE by using the command line. currently I select them by going to: Internet Options – Content – Certificates – Personal

    I would love to run a script each hour that will remove all personal certificates. Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

To Top