SEARCH

How-To Geek

Clear IE7 Browsing History From the Command Line

If you like to build batch files to automate cleanup on your computer, you’ll probably want to include at least one of these commands in your batch script. You can automate any one of the functions on the Internet Explorer 7 Delete Browsing History dialog.

Here’s the dialog that you are probably used to seeing:

And here’s the commands that correspond to the different buttons. The most important one from a cleanup perspective is the first, which will delete just the temporary internet files that are cluttering up your computer. 

To use these commands, just run them from the command line, the start menu search box in vista, or a batch file.

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 delete files and settings stored by add-ons”

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

 These commands should work in Internet Explorer 7 on XP or on Windows Vista.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 02/12/07

Comments (46)

  1. Karn

    I add the shortcut “RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1″. But it can not clear the IE7 history. If i use the dialog “Delete history”, the history can be deleted. Why?

  2. JT

    Same here. The ‘History’ is not deleted, no matter which script I use.

  3. cody

    If I do it from command prompt or start..run..cmd a box pops up and says”Error in InetCpl.cpl
    Missing entry:ClearMyTracksByProcess”
    Anybody know what the hell this means or is?????

  4. tom

    nice i like it . it worked out for me

  5. JT

    The “By Most Visited” History is not erased.

  6. RD

    My history was deleted. using IE7 on Xp Pro

  7. Netsanet

    I am now using the CLI window of /ubuntu.
    I want to use the i nternet on it.Any body can tell me how Iam able to do that

    thanks

  8. Exuroo

    Thanks dude

  9. LMO

    very nice, many thanks finally something that worked

  10. Samson

    I need something like this for IE 6. Would you have any ideas?

  11. TinnyFusion

    Create a standard txt file and add the following lines of code, save as a batch file (.bat rather than .txt) then simply run.

    @ECHO OFF
    ECHO * Cleaning Current User’s Temp Folders *
    FOR /D %%G IN (“C:\Documents and Settings\*.*”) DO DEL/S/Q/F “%%G\Cookies\*.*”
    FOR /D %%G IN (“C:\Documents and Settings\*.*”) DO DEL/S/Q/F “%%G\Local Settings\Temp\*.*”
    FOR /D %%G IN (“C:\Documents and Settings\*.*”) DO DEL/S/Q/F “%%G\Local Settings\History\*.*”
    FOR /D %%G IN (“C:\Documents and Settings\*.*”) DO DEL/S/Q/F “%%G\Local Settings\Temporary Internet Files\*.*”
    Echo * Done *
    PAUSE
    CLS

  12. eduardo

    does any one know how to delete off line contents from command line? API? inetcpl.cpl? from ie 6.0?

  13. moe

    This worked great for me as well. Now if I could find something similar for IE6. I tried several different things including the batch file posted above by TinnyFusion. They all look like they’re deleting files but when I go and check the folders, the cookies and everything else are still there. When I do it from windows, the folder is missing. :( Isn’t there a rundll32 type option for ie6?

  14. Silva

    TinnyFusion great stuff . I could simple extend it to clear index.dat and other unwanted files.

  15. Angela

    What about how to delete history (IE7/VISTA) for a user *other* than the current user? Like for an Administrator to delete a user’s history.

  16. Bob Mason

    It is many years since I wrote a batch file (Win 98 SE I think) could anyone use one the above command line scripts and give an example of how to write one for Vista please

  17. Dakota

    I was wondering if there is a way to put a password on my browsing history so it can not be deleted unless the password is put in? or something of that nature.
    Thanks

  18. Angela

    Dakota,

    What I do is restrict the user from deleting their own history using Group Policy. See my comment above. I fixed it so only Administrators can delete the user’s history with a batch file. That idea might be what you are looking for.

  19. russell

    I have run the delete all script (and done it manually) using the delete browsing history dialogue box – but it doesnt complete – the window comes up and runs for ages and ages – and doesnt seem to do anything, so I close it (using task manager) as thats the only way. I have re-booted. Any ideas what is causing this to fail?

  20. jono

    There must be a command line missing. I googled something, closed IE7 and ran a .BAT file containing all the commands you listed. When I reopened IE7 and searched Google using the same terms, the results showed links I had previously clicked on, coloured purple, which indicates that all history was not deleted.

    When you run “Delete All” from IE7 and revisit the Google terms you searched for, the results show links in blue, indicating that your search history was deleted from the previous session.

    Anyone knows how to correct this problem? Anyone know what the missing command line is that would delete previous Google searches? Better yet, does anyone know how to run “Delete All” automatically, like Firefox’s “Clear Private Data”, which deletes all session history simply by closing the browser?

  21. Nibbs

    >If I do it from command prompt or start..run..cmd a box pops up and says”Error in InetCpl.cpl
    Missing entry:ClearMyTracksByProcess”
    Anybody know what the hell this means or is?????

    I got this too – The reason I was getting it was because the ClearMyTracksByProcess is case sensitive (s^&tty). ~nibbs

  22. Shashank

    Good option. Before I used to go to %temp% and delete it.

  23. John

    Guyz,

    Need help..i will like to see the internet explorer history on the command prompt line..A friend of mine mention that even though u delete all the history,cookies,temporary internet files from the tools option..it still can be trace on the command prompt. can anyone provide me the command for it..and how do i permanantly delete all the information. Please help..Thanx

  24. clerison

    Hi,
    How can we set the Internet Explorer 7 to offline mode using command prompt statements.
    I have found enough information is given for clearing the history and changing the proxy server settings using command prompt. But I am unable to find out the command prompt statement to change the IE 7 to offline mode. Thanks for any help.

  25. TheRedQueen

    This is now one of my favorite toys. Thank you.

  26. Kirsty

    hey all!

    I am working for this company who keep trying to block me from social networking sites. Threy are using Open DNS and have manually blocked each pc by rerouting to the sites DNS address. I then deleted this address and had access to the sites however some brainiac has decided to block it from the server now which i can still unblock but im pretty sure this open DNS site is forwarding the browsing history….isnt there someway I can delete my history from the server before it gets to the open dns site??? I have full access to the server. thanks x x

  27. JJH

    I’ve included the command line to delete temp. internet files in IE7 in our organization’s Active Directory logon scripts. Anyone know if it’s possible to have it run in the background (so the end user doesn’t see the box that pops up)?

  28. vivek bahuguna

    These are path of browsing history of important browsers in Windows Vista:

    Mozzilla Firefox:

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Microsoft\Windows\Cookies

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files

    Bookmarks
    C:\Users\%Userprofile%\AppData\Roaming\Mozilla\Firefox\Profiles\uume24e5.default\places.sqlite

    History:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\History

    Typed Url:
    C:\Users\%Userprofile%\AppData\Local\Mozilla\Firefox\Profiles\uume24e5.default\cache

    Cache:
    C:\Users\%Userprofile%\AppData\Local\Mozilla\Firefox\Profiles\uume24e5.default\cache

    Internet Explorer:

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Microsoft\Windows\Cookies
    C:\Users\%Userprofile%\AppData\Roaming\Microsoft\Windows\Cookies\low

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files\low

    Favorites C:\Users\%Userprofile%\Favorites

    History:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\History

    Typed Url:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\History\History.IE5

    Opera:(7x)

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera75\Profile\cookies4.dat
    C:\Users\%Userprofile%\AppData\Roaming\\Microsoft\Windows\Cookies

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera75\Profile\cache4
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files

    Cache:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera75\Profile\cache4

    History:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera75\Profile\global.dat

    Bookmark:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\Opera6.adr
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\Opera6.adr.bak

    Typed Url
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\opera.dir

    Opera:(8x)

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\cookies4.dat
    C:\Users\%Userprofile%\AppData\Roaming\\Microsoft\Windows\Cookies

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\cache4
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files

    Cache:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\cache4

    History:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\global.dat

    Bookmark:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\Opera6.adr
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\Opera6.adr.bak

    Typed Url
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera8\Profile\opera.dir

    Opera:(10.10 beta)

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera 10.10 Beta\cookies4.dat

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\local\Opera\Opera 10.10 Beta\cache

    Bookmarks:
    C:\Users\%Userprofile%\AppData\Roaming\Opera\Opera 10.10 Beta\bookmarks.adr

    Netscape Navigator 9.0

    Temporary Internet Files:
    C:\Users\%Userprofile%\AppData\Local\Netscape\Navigator\Profiles\dim38g61.default\Cache

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Netscape\Navigator\Profiles\dim38g61.default\cookies.txt

    History:
    C:\Users\%Userprofile%\AppData\Roaming\Netscape\Navigator\Profiles\dim38g61.default\history.dat

    Favorites:
    C:\Users\%Userprofile%\AppData\Roaming\Netscape\Navigator\ Profiles\dim38g61.default\bookmarks.html
    C:\Users\%Userprofile%\AppData\Roaming\Netscape\Navigator\Profiles\dim38g61.default\bookmarks.bak

    Typed URL’s:
    C:\Users\%Userprofile%\AppData\Roaming\Netscape\Navigator\Profiles\dim38g61.default\localstore.rdf

    Flock(2.5):

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Local\Flock\Browser\Profiles\en6k2exm.default\Cache

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Flock\Browser\Profiles\en6k2exm.default\cookies.txt

    History:
    C:\Users\%Userprofile%\AppData\Roaming\Flock\Browser\Profiles\en6k2exm.default\history.dat

    Favorites:
    C:\Users\%Userprofile%\AppData\Roaming\Flock\Browser\Profiles\en6k2exm.default\bookmarks.html

    Typed URL’s:
    C:\Users\%Userprofile%\AppData\Roaming\Flock\Browser\Profiles\en6k2exm.default\localstore.rdf

    MSN explorer:

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Microsoft\Windows\Cookies

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files

    Favorites:
    C:\Users\%Userprofile%\AppData\Roaming\MSN6\Userdata\{}\favorites.xml

    History:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\History

    Typed URL’s:
    MSN Server

    AOL explorer:

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Microsoft\Windows\Cookies

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\Temporary Internet Files

    History:
    C:\Users\%Userprofile%\AppData\Local\Microsoft\Windows\History

    Favorites: AOL server

    Typed URL’s: AOL server

    Safari(3.0):

    Cookies:
    C:\Users\%Userprofile%\AppData\Roaming\Apple Computer\Safari\Cookies.plist

    Temporary internet files:
    C:\Users\%Userprofile%\AppData\Local\Apple Computer\Safari\Cache.db

    History:
    C:\Users\%Userprofile%\AppData\Roaming\Apple Computer\Safari\History.plist

    Bookmarks:
    C:\Users\%Userprofile%\AppData\Roaming\Apple Computer\Safari\Bookmarks.plist

    Typed URL’s:
    C:\Users\%Userprofile%\AppData\Roaming\Apple Computer\Safari\History.plist
    C:\Users\%Userprofile%\AppData\Roaming\Apple Computer\Safari\bookmarks.plist

  29. Hackoo

    ‘ This VBScript is used to Clear Cookies From Intrenet Explorer Made by Hackoo
    ‘it Works so fine for me :) and i hope that could help you !
    ‘web site :http://hackoo.ifrance.com

    set WshShell = CreateObject(“WScript.Shell”)
    user= WshShell.ExpandEnvironmentStrings(“%userprofile%”)
    Set fso = CreateObject(“Scripting.FileSystemObject”)

    file_path = user & “\Cookies”
    WScript.echo(file_path)
    Set folder = fso.getFolder(file_path)

    For Each Fichier in folder.Files
    If UCase(FSO.GetExtensionName(Fichier.Path)) = “TXT” Then
    fso.DeleteFile(Fichier)
    end if
    Next
    WScript.echo(“All the Cookies are deleted successfully!”)

  30. Bryan

    Any of this thing for Google Chrome??

  31. Mark

    I’m still having the same error (Missing entry:ClearMyTracksByProcess”) can anyone help please.

  32. Naveen

    This command (ClearMyTracksByProcess) will not work with IE6. Please check the browser and give it a try.. Else try the previous post by “vivek bahuguna”…..

  33. Joost

    All RunDll32 commands are working fine, but my cookies will not be deleted. What I’m doing wrong? Use Windows Vista.

  34. pranesh pradhan

    hi i am a tech guy and i can resolve ur issue

  35. pranesh pradhan

    bhai we are from hp team and from ankur team

  36. u64

    Dont forget these

    ::IE SuperCookies
    rd /s /q %TMP%\..\..\UserData
    copy/y NUL %TMP%\..\..\UserData
    attrib +h %TMP%\..\..\UserData

    And then we have
    Flash-SuperCookies
    Silverlight-SuperCookies
    HTML5-SuperCookies
    but that’s for another day.

  37. Passing

    Yep looks likle MS is doing all it can to stop people deleting bill gates little spy bugs so that even the best developers are pushed to delete the index.dat files and even if you manage to release the locks on the files then you still can not delete them from code because they are in what Bill and the gang call special folders.

    Even batch files won’t help you so i guess i’ll have to look at some way out api calls just to have a say on what i store in my file system.

    MS stick to OS and keep out of trying to monitor our ever move for your freinds at CIA central and i’m sure we will get on a bit better.

    u64

    you can add to the list

    DOM Storage, Etags, Javascript caching and AWT used by Google on top of the referere string so they know who you are without the need for cookies.

  38. Blu

    I am very new at internet browsing, and curiosity leads to all sorts of pages!!!!!!!!!
    How do I erase/delete my browsing history and bookmarks from my Apple Ipod?
    Please do not suggest the obvious because it does not work!!!

    Thank you

  39. Nirav

    Hello,

    I deleted histry but some url still not deleted. deleted all way ( means Regedit or normal deleting but still some not deleted ?

  40. Shab

    Great, it worked for me as well….

  41. Josh

    Hey, kids. I think I have what all of you are looking for. This will delete all of your Temporary Internet Files. I know it will work for Internet Explorer and Chrome for Windows XP, and it might also work for Vista and Windows 7. Just copy/paste the following into Command Prompt:

    CD%HOMEPATH%\LOCAL SETTINGS\TEMPORARY INTERNET FILES

    Hit Enter. Then type the following and hit Enter:

    del *.* /q

    That should delete everything in that folder. These commands can be easily turned into a batch file if you know what you are doing. I am having trouble with it working on my computer because my Temporary Internet Files is set for “Read-only” and for some reason I can’t change it. I don’t know if it’s a problem with Windows or if it’s just my computer.

    Hope that helps. Good luck, everyone! :)

  42. StewartW

    In case anybody is interested:

    public class IEClear
    {
    /*
    To clear IE temporary Internet files – ClearMyTracksByProcess 8
    To clear IE browsing cookies – ClearMyTracksByProcess 2
    To clear IE browsing history – ClearMyTracksByProcess 193 (ALSO deletes add on history)
    To clear IE form data- ClearMyTracksByProcess 16
    To clear IE remembered passwords for filling web login forms-ClearMyTracksByProcess 32
    To clear or delete all IE browsing history – all of above!- ClearMyTracksByProcess 255
    To clear IE Tracking- ClearMyTracksByProcess 2048
    * Preserve Favourites use 8192
    To clear IE Downloaded Files- ClearMyTracksByProcess 16384

    */

    public enum ClearFlags
    {
    DeleteCookies = 2, DeleteHistoryFiles = 8, DeleteFormData = 16, DeletePasswords = 32,
    DeleteHistory = 193, DeleteALLHistory = 255, DeleteTrackingInfo = 2048,
    PreserveFavourites = 8192, DeleteDownloadHistory = 16384, DeleteEverything = 22783
    };

    public void IEClearEverything(bool bPreserveFavs)
    {
    uint mask = 0;
    if (bPreserveFavs)
    mask |= (uint)ClearFlags.PreserveFavourites;

    mask |= (uint)ClearFlags.DeleteEverything;

    System.Diagnostics.Process.Start(“rundll32.exe”, “InetCpl.cpl,ClearMyTracksByProcess ” + mask.ToString()); // Delete All – Also delete files and settings stored by add-ons
    }

    public void IEClearHistory(bool PreserveFavs, bool TempFiles, bool Cookies, bool History, bool form, bool passwords, bool downloads)
    {
    uint mask = 0;

    if (PreserveFavs)
    mask |= (uint)ClearFlags.PreserveFavourites;

    if (TempFiles)
    mask |= (uint)ClearFlags.DeleteHistoryFiles;

    if (Cookies)
    mask |= (uint)ClearFlags.DeleteCookies;

    if (History)
    mask |= (uint)ClearFlags.DeleteHistory;

    if (form)
    mask |= (uint)ClearFlags.DeleteFormData;

    if (passwords)
    mask |= (uint)ClearFlags.DeletePasswords;

    if (downloads)
    mask |= (uint)ClearFlags.DeleteDownloadHistory;

    if (mask != 0)
    System.Diagnostics.Process.Start(“rundll32.exe”, “InetCpl.cpl,ClearMyTracksByProcess ” + mask.ToString()); //
    }

    public void IEClearFromFlags(uint Flags)
    {
    System.Diagnostics.Process.Start(“rundll32.exe”, “InetCpl.cpl,ClearMyTracksByProcess ” + Flags.ToString()); // Delete All – Also delete files and settings stored by add-ons
    }
    }

    Hope this help someone

    Stewart

  43. ratsarsed

    To /@ Passing:

    “Even batch files won’t help you so i guess i’ll have to look at some way out api calls
    just to have a say on what i store in MY FILE SYSTEM.

    MS stick to OS and keep out of trying to monitor our ever move for your freinds at
    CIA central and i’m sure we will get on a bit better.”

    “My file system” ? Umm guess you didn’t read the ULA.
    You can tinker till hell freezes over or the system is borked
    by you or a virus. Right back where you started.

    A solution, ( as opposed to your pitiful struggles to defeat some
    of the best programing of hundreds of the worlds finest minds,)
    might be to accept Windows for what it is. If you then still
    chose to run it, set up a virgin install configured to your needs,
    and make an image. Each day serve up a fresh copy of of your new
    pristine operating system. This is how library’s, computer labs,
    and business’s keep their computers from becoming zombies.
    There are hundreds of free Linux flavors to serve up fresh
    Windows from.
    A simpler if not cheaper method is just buy a Mac.

    Cheers and Good Luck
    ratsarsed

  44. chen

    ok

  45. Passing

    ratsarsed

    Moving to Linux is like buying a bike because driving cars is dangerious and i don’t care about the best programmers in the world as you call them, i just want privacy from Google, privacy from MS and i don’t think that is too much to ask.

    The term you are looking for is sandbox but this is too much trouble to maintain when i’m having to install new software and write software that works in the real world and since few people use Mac’s and even less Unix/Linux then your solution is not very helpfull

    MS is not the real problom anymore, it’s Google and MS has started to hand out some good tools like Fiddler to stop google spying and turning IE8 Tracking protection on is realy worth doing but i guess you use Firefox and don’t know who’s paying FF $50m a year or know about typing About:config into FF and then doing a seach for the world Google

  46. Passing

    StewartW

    Very nice code indeed, well written

    I knew about ‘ClearMyTracksByProcess 8′ and anothers that automates IE but it did not remove files from the super hidden folders like History.5ie (think the name is) plus Index.dat files didn’t shrink.

    In the end the only way i could find that worked in Win7 was to run a batch file from a second user account that had admin rights that renamed some folders and then copied folders/files back to the original location

    At startup the account does not have the correct rights and the files are locked by the Explorer process even before you log on but i didn’t try setting the user from Dos/Script because it would mean putting the user name and password in the batch file, hence ran from another account.

    You might like to play with MS-Fiddler ! Easy to create a DLL that you drop into the fiddler’s folder that gets called because fiddler is plugable and it’s easy to extend to create you own cache and blocks for HTTPS/443 and bits like that but it’s also usefull for corrupting the referer strings, user agents, cookies so that spyware servers end up with useless data.

    After all it’s my processor, my bandwidth and my disk space is it not and seems the only way to realy stop this spying

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!