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
http://support.microsoft.com/kb/321379

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:
C:\Windows\Printdir.bat
%windir%/Printdir.bat

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"
exit

You can now right click on any folder and choose Print Directory Listing(Wording can be changed by following http://www.makeuseof.com/tag/how-to-add-remove-entries-from-the-right-click-menu/) This will then open Notepad and display a list of all the folders and files.

Advertisements

2 thoughts on “Add Print Directory Listing to the Right Click menu

  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”
    wait

    and now it waits until I close notepad.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s