Clear IE From Command Line

ie7-history-command-prompt

Batch it up, Fuzzball!

There’s lots of little files accumulating on your computer… like bacteria.  Every time you browse the interenet, little bits of data are saved onto your hard drive.

There’s several reasons you need to clean these files out periodically.  For one, there’s the privacy issue: do you really want your browsing history available to anyone who has access to your computer?  The other reason to clean up your files is just for the sake of tidiness.  Many of the files kept by your browser are very small, and eat up more space than they should (for example, a 300-byte GIF file will use up 4K on a typical hard drive today).

Every browser has an interface to clean up all of these files, but you have to go to several differnent places to clean them all up… which is very tedious if you like to clear this out frequently.  Fortunately, all of these functions are available via the command line, which means you can automate all of these tasks.  You can integrate this batch file with your existing logon or logoff scripts, or just have the file on your desktop for one-click cleanup!

Listed below are the areas that can be cleaned up, followed by the command that clears it out.  You can have as many or as few as you like.  If you want to just delete everything, then just run the last command in the list… which clears out everything.


Temporary Internet Files
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

Cookies
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

History
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

Form Data
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

Passwords
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

Delete All
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Delete All (Also deletes files and settings stored by add-ons)
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

These commands work with Windows XP and Vista on IE versions 6 and higher.  They will probably work on IE5, but hasn’t been tested.

Alan is a web architect, stand-up comedian, and your friendly neighborhood Grammar Nazi. You can stalk him on the Interwebs via Google+, Facebook and follow his ass on Twitter @ocmodshop.