Recent Documents

While I use 4NT8, the following should work with later JPSoftware products.

There are certain documents that I access almost everyday, which I like to open without having to hunt for them.

Windows XP provides a list of recent documents by clicking Start, Documents. This list of Recent Documents, or sometimes called MRU (Most Recently Used) makes it very quick to open the documents that I use the most.

Every evening, before I do my daily backup, I use Cache Cleaner, available from, to remove unwanted files from my system.

Cache Cleaner has an option to exclude the Recent Documents from being cleared, but in the course of a day, there are other documents that I create, which I will seldom access, so I allow Cache Cleaner to remove all Recent Documents from the MRU list.

Every morning, one of the first programs that gets started on my system is 4NT8. One of the first things that 4NT8 does is to run 4start.btm.

4start.btm is the logical place to call a batch file that will load the Recent Documents list with all of the documents that I access everyday.

To load a document into the Recent Documents list from 4NT8, I do the following;

echo %@winapi[shell32,SHAddToRecentDocs,2,a"C:\Documents and Settings\jlc\My Documents\Yaris Fuel Milage.xlr"]
echo %@winapi[shell32,SHAddToRecentDocs,2,a"C:\Documents and Settings\jlc\My Documents\Debt.xlr"]
These are just two examples. You can add up to 15 items to the Recent Documents list in Windows XP. There is a way to increase the number of items in the Recent Documents list in Windows XP, but 15 is adequate for my needs.

If you want to clear the Recent Documents list from 4NT8, the following will do just that,

echo %@winapi[shell32,SHAddToRecentDocs,2,0]
Note in the call to add a document to the Recent Documents list, that I have an “a” before the path\filename.

Here’s what the 4NT8 help file has to say about that;

"string" - text argument (this must be enclosed in double quotes). If the argument is preceded by an 'a' (i.e., a"Argument") then it is converted from Unicode to ASCII before calling the API. (Some Windows APIs only accept ASCII arguments.)
Hope that this tip proves useful for others, as it has for me.

::| Add items to the Most Recently Used list, or
::| Clear all items from the Most Recently Used List
::| Microsoft Windows Vista Business
::| TCC 15.01.52
::| July 5, 2013
::| Joe Caverly
::| Ref.
@echo off
iff %# eq 0 then
  gosub Usage
  goto eoj
switch %1
case add
  iff exist %2 then
    echo %@winapi[shell32,SHAddToRecentDocs,2,a%@truename[%2]] > nul
    echo Could not find the file named %2
    goto eoj
case clear
  echo %@winapi[shell32,SHAddToRecentDocs,2,0] > nul
  echo I do not know what %1 means.
  gosub Usage
  goto eoj
goto eoj:
echo Usage: MRU add myfile.ext
echo        MRU clear
May 20, 2008
Elkridge, MD, USA
The endlocal which follows quit is never actually executed, but quit (more exactly, exiting the batch program by its execution) forces an implied endlocal. Is that endlocal in your code to remind you that it is implied?
Nov 2, 2008
MRU works under Windows 2k as well. I copied the whole batch file into my batch repositary. thanks!