Web Analytics


If you are in need of printing out the content of your folders, more regularly than often – you have probably already got a freeware of sort to help you do that. However, wouldn’t it be great if you could right-click a folder and choose “Print Directory” instead ?

Well, I found out how to do so.

With a small executable batch-file, and a little registry tweak you can create a Context-Menu that, will print the content of any folder. Simply Right Click the folder name, Choose: Print Directory and: Voila.

To all you freeware developers out there… I’m so Sorry …

Here’s how

First,  let me point out – for Windows XP users, there are THREE steps and for Vista/Windows 7 Users there are only two. So pay attention to my lead, okay ? Good. Let’s get it on.

Step 1 (all Windows Versions)

First, we need to create a small executable batch file, which we’ll call something like: Printdir.bat.

  1. Click Start, click Run, type notepad, and click OK.
  2. Paste the following text into Notepad:
    @echo off
    dir %1 /-p /o:gn > "%temp%\Listing"
    start /w notepad /p "%temp%\Listing"
    del "%temp%\Listing"
    exit
  3. Choose File, Save As
  4. In the Save As dialog box, type: %windir%\Printdir.bat
    (This will save the file in your Windows Directory).
  5. Click Save

Step 2 (XP Users Only)

In Windows XP, we now need to create a new action for file folders.

  1. Click Start, then Control Panel, and then click Folder Options.
    (Or, click Start, point to Settings, click Control Panel, and then click Folder Options.)
  2. On the File Types tab, click File Folder.
  3. Click Advanced, and then New.
  4. In the Action box, type: Print Directory.
  5. In the Application used to perform action box, type: printdir.bat.
  6. Click OK.
  7. Click OK two more times, and then click Close.

At this point you may Right-Click a folder and see if you are able to print out the contents. If successful, you’re done. If not, Move to Step 3.

Step 3 (XP Users only – Vista/Windows 7 jump to step 4)

This part require that you edit the Registry. Make sure you backup your registry to avoid serious errors. Once you have done that, you may continue.

  1. Start Registry Editor.
  2. Locate the Default value under the following registry subkey:
    HKEY_CLASSES_ROOT\Directory\shell
  3. On the Edit menu, click Modify.
  4. In the Value data box, type: none.
  5. Click OK.
  6. Exit Registry Editor.

Step 4 (Vista / Windows 7 Users)

This part require that you edit the Registry. Make sure you backup your registry to avoid serious errors. Once you have done that, you may continue.

  1. Start Registry Editor.
  2. Locate the following registry key:
    HKEY_CLASSES_ROOT\Directory\shell
  3. Right Click the folder named Shell, choose New, Key.
  4. Type: Print Directory, and press ENTER.
  5. Right-Click on “Print Directory”, Choose New, Key.
  6. Call the new key: command, then press ENTER.
  7. Double-click the  default entry. Type: Printdir.bat "%1", in the Value field. (Thanks for the tip in the comments Edward.)
  8. Click OK, and exit Registry Editor.

There you go !

About Thomas

Computer geek from the age of 7, which amounts to 30 years of computer experience. From the early days (when every computer company had their own OS) of DOS, Windows 1.0 through Seven...

Free PC tips by email

Search Windows Guides




Comments

14 thoughts on “Print Content of Directory from your Context Menu [How To]”

  1. Rich says:

    Nice tip! Thanks.

  2. Rich says:

    Nice tip! Thanks.

  3. batupata says:

    Nice tip. This was already in one of my unpublished programs, going to publish it when I come from Germany :)

  4. mintywhite says:

    Looking forward to it!

  5. edwardfairchild says:

    There is one minor bug in what you gave. It will not correctly print a directory which has a space in its full pathname, i.e. a sub-folder of Program Files (x86). To fix this problem, you only need to change the registry entry to

    Printdir.bat “%1”

    Regards.

  6. mintywhite says:

    Thank you for this information. I've updated the guide to reflect this.

  7. edwardfairchild says:

    I have one other suggestion. (You are going to get tired of me!) If you put an equivalent entry under the HKEY_CLASSES_ROOTDrive registry entry to match the HKEY_CLASSES_ROOTDirectory entry, you will then be able to print the root directories of your drives. Alternatively, remove the entry from either place and put it in the HKEY_CLASSES_ROOTFolder registry entry. Ones put here show up on both directory and drive context menus. Regards, again.

  8. mintywhite says:

    Thank you :)

  9. sulasno says:

    great tip ^^^

  10. witelite says:

    re Step 1 (all Windows Versions) > at step 4, when I try to save the notepad “%windir%Printdir.bat” I get an error message saying “C:WindowsPrintdir.bat” You don't have permission to save in this section. Contact the administrator to obtain permission. Would you like to save in the “user” folder instead?” This is obviously not the Windows Directory location you advise.
    I am the user and my user is an administrator. I am using “Windows 7 Ultimate 32 bit” operating system on a pc with 4GB of RAM. What am I doing wrong in following your tutorial?

  11. xmascook says:

    This was a lifesaver. My Vista x64 system crashed and had to be restored. I had many files backed up but needed to recreate my customized Start Menu from what I could remember. I modified and created a second version of printdir.bat that would use the DIR /S option to print out the current and all subfolders from another context menu item I named Print ALL Subdirs. I remarked out the batch file line that deleted the LISTING file so I could go into my %temp% directory and copy the LISTING file to my Documents folder and save it forever. Now that I've recreated my complext Start Menu and submenus, I've got a copy of all the subfolders and links that are in it so if disaster strikes again and I only have a backup of my Documents folder, at least I'll have help recreating my Start Menu. It will still be a lot of work. Too bad there isn't a way to save and restore an entire user's customized Start Menu by just copying over a file.

  12. Harsha says:

    Hi.
    A Great Tip.
    I'm working on the same lines here and i need guidance.
    I'm looking to run a dos application with switches from the right click menu on the folder of choice.
    However, I'm unable to do so.
    I'm the member of this site as well.

    Please help me out on this.
    With your tip, i got to know how to get a right click menu.
    I would want to run the dos application from a batch file for visual effects.. ;).

    Please reply back for any info required or answers.

    Regards,
    Harsha

  13. Rich says:

    Harsha, you may find you get a better response in the forums.

  14. Shumaker Jill says:

    I use Print Directory to print file list.

Comments are closed.


Computer tips in your inbox
Sign up for the Windows Guides newsletter to get PC tips and access to free Windows books (More details)

Subscribe now
Popular Guides

See which sites have been visited on your PC (even if private browsing mode is used)

Create a Windows 7 System Repair Disc

Best Free Anti-malware

Hibernate vs. Sleep vs. Shut-Down

i3, i5, and i7; Dual, Quad, Hexa Core Processors. How to they Differ?

Intel's Ivy Bridge Processor: new Features

Windows Guides on Facebook