Add Print Directory Listing to the Right Click menu

Based on Microsoft KB 321379

I had user request that he regularly wanted to produce a list of all files in a particular folder. This How-To is based on the following Microsoft KB Article

In essence it adds a menu to the right click menu, so you right click on a folder in explorer and click Print Directory Listing and either Prints it straight to a printer(standard functionality) or Opens it in Notepad(My functionality), you can then import it into Excel.

While the original functionality is good, it isn’t ideal. The original will print the directory listing with modified dates, files size and some other info, straight to your default printer.

The right click option seen in the screenshot at the top of this post runs a script in:

Opening the script in Notepad, I changed it to show me just file names and paste it into notepad.

I change the script to:

@echo off
dir %1 /-p /-b /o:gn > "%temp%Listing"
start /w notepad "%temp%Listing"
del "%temp%Listing"

You can now right click on any folder and choose Print Directory Listing(Wording can be changed by following This will then open Notepad and display a list of all the folders and files.


  1. The above bat file works, unfortunately on my system the listing flashes on the screen for 0.2 seconds then disappears.
    I changed it to

    @echo off
    dir %1 /-p /-b /o:gn > “%temp%Listing”
    start /w notepad “%temp%Listing”

    and now it waits until I close notepad.

Leave a Reply

Your email address will not be published. Required fields are marked *