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.
- Click Start, click Run, type notepad, and click OK.
- 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 - Choose File, Save As
- In the Save As dialog box, type:
%windir%\Printdir.bat
(This will save the file in your Windows Directory). - Click Save
Step 2 (XP Users Only)
In Windows XP, we now need to create a new action for file folders.
- Click Start, then Control Panel, and then click Folder Options.
(Or, click Start, point to Settings, click Control Panel, and then click Folder Options.) - On the File Types tab, click File Folder.
- Click Advanced, and then New.
- In the Action box, type:
Print Directory
. - In the Application used to perform action box, type:
printdir.bat.
- Click OK.
- 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.
- Start Registry Editor.
- Locate the Default value under the following registry subkey:
HKEY_CLASSES_ROOT\Directory\shell
- On the Edit menu, click Modify.
- In the Value data box, type: none.
- Click OK.
- 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.
- Start Registry Editor.
- Locate the following registry key:
HKEY_CLASSES_ROOT\Directory\shell
- Right Click the folder named Shell, choose New, Key.
- Type:
Print Directory
, and press ENTER. - Right-Click on “Print Directory”, Choose New, Key.
- Call the new key:
command
, then press ENTER. - Double-click the default entry. Type:
Printdir.bat "%1"
, in the Value field. (Thanks for the tip in the comments Edward.) - 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...
Nice tip! Thanks.
Nice tip! Thanks.
Nice tip. This was already in one of my unpublished programs, going to publish it when I come from Germany :)
Looking forward to it!
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.
Thank you for this information. I've updated the guide to reflect this.
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.
Thank you :)
great tip ^^^
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?
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.
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
Harsha, you may find you get a better response in the forums.
I use Print Directory to print file list.