Gizmos Needs You

Gizmo's Freeware is Recruiting

 We are looking for people with skills or interest in the following areas:
 -  Mobile Platform App Reviews for Android and iOS
 -  Windows, Mac and Linux software reviews       Interested? Click here

                  

 

How to Make a Folder File List from the Windows Right-Click Context Menu

Have you ever wanted to make a list of all the files in a folder? If you have, you discovered that this is a feature that is missing in Windows Explorer. Of course, you can use the command line to do this or download and install some extra software but there is an easier way.

Print Directory added to context menuThe simple way is to add the capacity to print a folder file list from the right-click context menu of a given folder. Microsoft describes the procedure at this link  and provides a "Fix-it" file that will add the desired command to all folder context menus. I have tried running the Fix-it file in Windows XP Professional and Windows 7 64-bit and it worked with no problems. A command “Print Directory Listing” is added to the right-click context menu of folders (directories). An example of a modified context menu is shown in the figure on the left.

Whatever printer is designated as the default for your system will be used. Note that this need not be a hardware printer. Printer drivers exist for creating files in certain formats such as Adobe PDF or Microsoft XPS. Instead of a paper list you could create a list as a PDF file or other type of file format if you have a driver that you can designate as the default printer. Changing default printers is very easy so this method also provides a way to create files that list the contents of a folder.

There you have it- paper or file, a list of the contents of a folder in just two clicks.

This tip was inspired by a question from reader John Lane.

Get your own favorite tip published!  Know a neat tech tip or trick?  Then why not have it published here and receive full credit?  Click here to tell us your tip.


This tips section is maintained by Vic Laurie. Vic runs several websites with Windows how-to's and tutorials, including  a computer education website and a site for learning about the command line.

Click here for more items like this. Better still, get Tech Tips delivered via your RSS feeder or alternatively, have the RSS feed sent as email direct to your in-box.

Share this
4.09091
Average: 4.1 (22 votes)
Your rating: None

Comments

by A. Nonny Mouse (not verified) on 6. September 2012 - 4:34  (98852)

MYKY wrote:
"Microsoft solution is totally useless - without any control!!!"
Sounds just like a Microsoft solution.
As does all the babble above about printers and drivers.

Try this method:
http://www.theeldergeek.com/file_list_generator.htm
'Generate a File Listing from a Windows Explorer Context Menu'
And read the section "Additional File Modifications Submitted by TEG Readers" particularly the first one.

by AAMMYY (not verified) on 25. May 2012 - 17:48  (93953)

I used this on a work computer and now every time I double click a folder in Windows Explorer it opens the folder into a "Search" window instead of just exploring it the way it used to. HELP!!

by v.laurie on 25. May 2012 - 18:28  (93956)

I am not sure what the problem is but, if you used the Microsoft Fix-it wizard, you should have a system restore point that you can use to undo the change. If you edited the Registry yourself, I assume you have a backup that you can use.

by 0r3n03 (not verified) on 4. February 2012 - 1:10  (88259)

i recommend MaxLister to make great list's includes sub directories, i'm using it for years, it's free and no install needed!

by Chip W (not verified) on 30. December 2011 - 10:24  (86219)

Don't know if this article is still active, but ...
The article mentioned print drivers to direct print output to a file, like a PDF or text file. Where does a guy get one of of these drivers?
When I print there's an option "Print to file" which creates a file of type "File" that is unopenable as far as I can determine.
Twould be nice to direct output to an accessible file.

by v.laurie on 30. December 2011 - 14:23  (86232)

Try using Notepad to read a file created by "Print to file". Also in Vista and Windows 7 there is something called an XPS document writer. It is a Microsoft format described at http://msdn.microsoft.com/en-us/library/windows/desktop/dd145058(v=vs.85).aspx. It can be downloaded for XP as well. Drivers for printing to a PDF file come with various PDF readers. Try looking in your list of installed printers.

by Drizzle (not verified) on 12. December 2011 - 17:41  (84907)

Love it - but it only shows the first level. Can anyone recommend a program that will allow me to print out the contents of subdirectories as well?

by v.laurie on 12. December 2011 - 19:55  (84917)

Comments are not the place for long detailed answers but, in brief, using the command "dir /s" will list sub-directories as well as the working directory. More details are at this link- http://commandwindows.com/command2.htm. Also please note the batch file "Printdir.bat" provided by Microsoft in the link http://support.microsoft.com/kb/321379 given in the tip. You can try adding the "/s" switch to the dir command in that file. But be aware that printing the contents of all the sub-directories can be a long job.

by Drizzle (not verified) on 14. December 2011 - 13:35  (85007)

Thank you - as I really want to sort out the duplicated files on my system I'll have a go at that.

by J_L on 11. December 2011 - 23:41  (84852)

I prefer the CMD command stored in a batch file and task scheduled.

by Liz (not verified) on 11. December 2011 - 22:24  (84845)

This has the potential to be so useful, I just wish it would go to the txt file and stop - then the user could choose whether to print it or not and specify to which printer - pdf, physical print etc...

Mostly when I need this sort of thing its an electronic file list I need not a physical copy - and I don't want to have to change my default printer and then change it back just to use this tool. Would be quicker to do it though the command line.

Does anyone know if Microsoft has made another version that just sends it to a txt file?

by txreal (not verified) on 5. September 2012 - 17:00  (98827)

Liz, I also wanted that and figured it out from v. Laurie's comment above and Remah's comment below. All you have to do is replace the microsoft's batch file with this one

@echo off
dir %1 /s /-p /o:gn > "%temp%\Listing"
start /w notepad "%temp%\Listing"
exit

by Remah on 11. December 2011 - 23:44  (84853)

Liz, the following instructions probably contains more detail than you need but I included it for others who may want to do this.

To do what you want you just need to edit the Printdir.bat that you have created in the %windir% folder. There is another article How to add the print directory feature to Windows Explorer that shows another way to create the printdir.bat file manually.

There is a Windows commandline tool PRINT which allows you to specify the printer device to print to. It takes an additional step to find out your device name so I wouldn't use it because it is easier to use a command that uses the printer name. Also, devicenames have more variety than years ago when we usually only printed to PRN, LPTx or COMx.
PRINT Prints a text file.
PRINT [/D:device] [[drive:][path]filename
/D:device Specifies a print device.

A better command to use allows you to change the default printer before you print and then after printing you change it back.
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"

The printer is the name of your printer. In Windows 7, I go to Control Panel > Devices and printers then into 'Properties' or 'Printer Properties' for that printer to copy the name.

Try it out yourself, I did from Start Menu > All Programs > Accessories > Command prompt. I had the Windows 7 printer list open and I watched the default printer changing - the green tick moves immediately.

So all you have to do is to change the Printdir.bat file to match the file below - remember to change printer to the name of one of your printers. Either edit the Printdir.bat file or create a new one to overwrite it:
dir %1 /-p /o:gn > "%temp%\Listing"
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"
start /w notepad /p "%temp%\Listing"
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"
del "%temp%\Listing"
exit

Here's how it works for my system:
dir %1 /-p /o:gn > "%temp%\Listing"
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "Canon Inkjet MP220 series"
start /w notepad /p "%temp%\Listing"
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "HP Universal Printing PCL 6"
del "%temp%\Listing"
exit

For a useful reference list of commands and examples go to Command Line Printer Control in Windows 2000 / XP. These commands also work for Windows Vista and 7. Note that some will open Windows programs and take you out of the commandline interface.

Incidentally, if you often change printers then you can create a batch command that you put in your menu or task bar so it is a one click to change the default printer.

by Remah on 12. December 2011 - 0:05  (84854)

Liz, somehow I answered the wrong question. Here's your answer.

The command file you create, Printdir.bat, creates a text file and then deletes it after printing it. If you don't want to print it then delete these lines:
start /w notepad /p "%temp%\Listing"
del "%temp%\Listing"

Then change this line to specify where you want the file to go. Here I've made it go to the desktop:
dir %1 /-p /o:gn > "%userprofile%\desktop\listing"

Personally, having grown up in the DOS dark ages, I would include an extension of ".txt" on the file to indicate the file type:
dir %1 /-p /o:gn > "%userprofile%\desktop\listing.txt"

by Liz (not verified) on 14. December 2011 - 19:34  (85024)

Hi Remah,

Thanks so much for this. It all looks straightforward but I am always wary of editing the registry. :)

Liz

by Remah on 14. December 2011 - 19:56  (85026)

Just to be clear. The Microsoft solution linked to in this article (http://support.microsoft.com/kb/321379) tells you how to do all the registry changes automatically without any manual editing.
All that I've given you are changes to the instructions that you would type in at the Windows command line. Microsoft tells you how to create a batch command file called printdir.bat which automates those commands. This is the file that you are editing.

by Rodders (not verified) on 10. December 2011 - 18:45  (84771)

Thanks for this, I needed this a couple of days ago and hey presto once again you guys come up trumps.

by arvee07 (not verified) on 10. December 2011 - 15:32  (84765)

A much better solution is the freeware program 'Print Folder 1.3' available at http://no-nonsense-software.com/freeware/

I have used it for years, and it works on Windows 7 (64 bit)as long as you set compatibility to Windows XP (SP 3).

by JMM (not verified) on 9. December 2011 - 20:19  (84729)

This worked but went directly to my default physical printer without an opportunity to print to pdf file like I usually do. Any ideas how to get it to ask where to print? Thx.

by v.laurie on 9. December 2011 - 20:58  (84731)

It is set to always use the default printer. If you have a PDF printer driver, set that as the default printer whenever you want to create a PDF list.

by rhiannon on 10. December 2011 - 5:59  (84748)

Great tip Vic, thanks. I don't have my physical printer on so it's going directly to OneNote (the default).

by WebHybrid (not verified) on 9. December 2011 - 16:05  (84718)

Excellent.

Great idea, and the Fix-It worked fine for Vista 32-bit.

by Mihai (not verified) on 9. December 2011 - 15:49  (84714)

just press Open Comand Propt Here

an then
dir /ON /B > list.txt

you shall find the results in list.txt in the same director.

by MYKY (not verified) on 9. December 2011 - 14:45  (84712)

Microsoft solution is totally useless - without any control!!!

by Sa3dany (not verified) on 9. December 2011 - 11:31  (84694)

Is there any way to make it only show when holding the ctrl key?
Sorry, I didn't read the link. So I don't know if it is described there.

by Mike J (not verified) on 9. December 2011 - 9:29  (84687)

Has anybody tried this freeware program:

Right-Click Extender for Windows 7

http://www.thewindowsclub.com/right-click-context-menu-extender-for-windows-7-released