Clear Internet Explorer Cache using Rundll32 Command-Line

The rundll32 command-line involving inetcpl.cpl and the entry point ClearMyTracksByProcess which is widely in use since Internet Explorer 7, is effective only if it’s run in low integrity level. This is because in Windows Vista and higher, Internet Explorer manages two different cache containers, one for the Protected Mode and another cache folder to store files when Internet Explorer is outside the Protected Mode.

When a user executes the following command in order to clear the cache:

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

The command executes with a Medium integrity level and thus clears only the cache folder for websites visited outside of Protected Mode. Whereas all of your cache files are in the Protected mode area, that is under the Low directory.

In order to properly clear the cache, you’ll have to run the same command again but this time launch it in Low integrity level. This is what Internet Explorer exactly does when you try to clear the cache via menu options. This is evident from the following graphic.

Clear Internet Explorer Cache

How to Clear Internet Explorer Cache Using Command-Line?

To properly clear the Internet Explorer Temporary Internet Files cache, use one of these options.

Option 1: Using PsExec.exe

Use from Windows SysInternals to launch Rundll32.exe with low Integrity Level. Download PsExec.exe from Windows SysInternals and save it to a convenient location. To clear IE cache, run this command:

<Path:>\psexec.exe -l c:\windows\system32\RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

Example:

c:\tools\psexec.exe -l c:\windows\system32\RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

Thanks to magicandre1987 at StackOverflow for the PsExec tip.

Option 2: Make a Copy of Rundll32.exe and Set it to Run with Low IL

Open your Windows\System32 directory. Make a copy of rundll32.exe and name the copy as rundll32-low.exe

Clear Internet Explorer Cache

Now, open an elevated or administrator Command Prompt, and type in:

icacls rundll32-low.exe /setintegritylevel low

You should “see the successfully processed 1 files” in the output.



Clear Internet Explorer Cache

Optionally, make a note of the disk space consumed by Internet Explorer’s Temporary Internet Files\Low directory, that’s where the real cache (for Protected mode) is stored.

Clear Internet Explorer Cache

Press WinKey + R, and type the command-line to clear the IE cache, but this time using rundll32-low.exe.

RunDll32-low.exe InetCpl.cpl,ClearMyTracksByProcess 8

Clear Internet Explorer Cache

That does the job perfectly. Here you go.

Clear Internet Explorer Cache

You could also make a shortcut to the above command-line if you want.

Note: The above method has a small drawback. The rundll32-low.exe process does clear the cache perfectly, but doesn’t exit cleanly. The process shows up in Task Manager until you exit it manually. This shouldn’t affect the performance though.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

6 thoughts on “Clear Internet Explorer Cache using Rundll32 Command-Line”

  1. Hey that’s a massively useful information. Especially with IE9, Microsoft introduced a very annoying and useless notification when you clear your history etc from within IE9 which you have close. So I preferred the Rundll32 method as it did not produce a notification on the notification bar. But now I’ll have to use CleanIETempFiles.exe.

  2. Btw is there a Rundll32 command to display the system Delete browsing history dialog so you select every time what you want to clear?

  3. @anon: As far as I know, there’s not any built-in command to show the Delete browsing history dialog box. I think it is hardcoded in Internet Explorer resources and accessible only by the own browser. It would not be difficult to manually make a similar one, but I would need to investigate more about some ClearMyTracksByProcess flags. (Thanks, Process Explorer.)

    The GUI will be included in the next version of CleanIETempFiles.

    Thanks!

  4. Hi Martin,
    Thank you so much for your valuable utility. I use RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess and I very much wanted to hide the UI.
    I have been searching for a solution to delete the internet explorer history (Version 7,8) with the UI being hidden(popup saying please wait while the history is being deleted) for a long time and I could not find any. All last I found yours. Many Thanks.

    Best Regards,
    Flavian Borgia

  5. I created a button in IE9 to clear the history this way and use it instead of the built-in button:

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions\{BB4899B0-206D-47ad-B110-B64D8CEE8796}]
    “ButtonText”=”Delete internet history…”
    “Icon”=”HistoryClear.ico”
    “HotIcon”=”HistoryClear.ico”
    “Default Visible”=”Yes”
    “CLSID”=”{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}”
    “Exec”=”cleanIETempFiles.exe”

    It only runs as long as I don’t supply any switches. The moment I use something like cleanIEtempfiles.exe -t, it says “Windows cannot find the file”. What could be the problem? Both cleanIEtempfiles.exe and the icon file are in my Windows folder and they run flawlessly when run without the -t switch.

Leave a Comment