Did you notice that in Windows XP it takes exactly half a dozen mouse clicks to clear the Recent Documents history in the new Start menu. This is the option that I’m talking about:

One of our readers asked "I need a batch file or script to clear the recent documents list from the Windows XP Start Menu". This is a legitimate request. So, here is a VBScript that’ll automate the work for you. It works in Windows XP, Windows Vista and Windows 7. Note that if you’re using Windows Vista/7, there is no real need for such a script, because you can do it directly from the Start menu. (Click Start, right-click Recent Items, and then click Clear Recent Items List)

Script to Clear Recent Documents History (Windows XP/Vista/7)

Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
sRD = WshShell.SpecialFolders("Recent")
if sRD <> "" then
    On Error Resume Next
    objFSO.DeleteFile(sRD & "\*.lnk")
end if

Instructions

Copy the above code to Notepad, and save the file with .vbs extension. (e.g. clearrecent.vbs) You can then move this script to your Quick Launch folder for easy access. Note that if you create a shortcut of the script in the Quick Launch folder, you can even customize the icon if you’re bored of seeing the default Windows Script icon.

Related Posts


Email SubscriptionPrefer an E-mail subscription?

Enter your email address:

Delivered by FeedBurner

7 Comments

  1. Daron Johnson
    said this on Sunday, August 1st 2010 4:19 am

    Thank you, works great

  2. said this on Saturday, May 29th 2010 2:57 pm

    this script very heklpfull. Thanks

  3. Greg Robert
    said this on Monday, April 19th 2010 8:55 am

    Wow, such quick help!

    Have modified my version and tested and all is well.

    Thanks Ramesh!

    - Greg

  4. said this on Monday, April 19th 2010 8:44 am

    @Greg: Updated the script in article.

  5. Greg Robert
    said this on Monday, April 19th 2010 8:04 am

    Ramesh,

    Oh, I see the bug. sRD is the pathname to the recent files folder. However, since the folder always exists, the test is always true, even if the folder is empty. So it always tries to delete the links and, when there ARE NO links, it gets an error.

    Is there a way to suppress the error and continue execution?

    - Greg

  6. Sir
    said this on Monday, November 9th 2009 6:22 am

    This Works!

  7. Emarell
    said this on Saturday, April 11th 2009 7:43 pm

    Another masterful article by Ramesh Srinivasan – thank you again. The method I found here months ago (here- http://www.winhelponline.com/blog/clear-recent-items-list-missing-right-click-recent-folder/) has turned out to work only until the next reboot. Vista manages to shred it up over and over – so annoying.

    The whole Recent Items function is buggy in Vista; some documents do not get listed after they are opened, some do. I have yet to discern a pattern.

    However, at least for clearing the list, the script offered on this page will work. It stays put too. Really. No kidding.

Leave a Reply