batch-fileprintingrecent-file-list

Batch code that will print a list of what is inside the "Recent Items" folder


I am trying to get a batch code to print the just the Date Modified, and Name of each file (more properties are ok, I just need those two) in the "Recent Items" folder. I have tried a few codes but sadly it will not work, any direction would be greatly appreciated.


Solution

  • Recent items is located here:

    %userprofile%\Appdata\Roaming\Microsoft\Windows\Recent

    But it contains only links (.lnk files ) to the recent opened items. So

    dir /o:d /t:c   "%userprofile%\Appdata\Roaming\Microsoft\Windows\Recent"
    

    Will list them but it will be hard to distinguish files form directories.

    Here's how you can get more info with WMIC query (could be slow):

    WMIC DATAFILE WHERE "PATH='\\Users\\username\\Appdata\\Roaming\\Microsoft\\Windows\\Recent\\'  " GET LastAccessed, LastModified, Name, FileSize