Cleaning Out the Recent Documents List In Windows XP


The batch program that follows, called CleanRecent.bat, removes some of the files from the recently used documents list that you see if you select My Recent Documents from the Start menu. Removing document types that you don’t want on this list allows room for more of the documents that you do want to see.

@echo off
rem Cleans unwanted file types from the Recent folder
title Clean Recent
echo Cleaning Recent folder...
for %%t in (wav log ini) do del "%userprofile%\recent\*.%%t.lnk"
echo.
echo Done cleaning Recent folder.
title Command Prompt


This batch program uses the For…In…Do command to repeatedly execute the Del command. The document type file name extensions that you want to remove from the list are enclosed in the parentheses. The For command executes the Del command once for each entry in this list. The variable %%T contains the current extension and is substituted in the Del command. This is effectively the same as typing three Del commands.

Note that the file names have an .lnk extension added. This is because the Recent folder contains shortcuts (which have the extension .lnk) rather than containing the actual recently used files.