Printing Directory & File Lists In Windows 7
Posted by William Diaz on September 1, 2011
There is no native built-in way (still) in Windows to print a list of files displayed in Windows Explorer from Windows Explorer. For occasional use, though, there is a command line method which utilizes the DIR command and piping the results to a text file. To do this:
Open the command shell
Navigate to the directory you want to print a list of using the cd\ path command
Then use the Dir >listing.txt to pipe the results to a file
The file can be found in the directory you where the command was run
If access is denied, you will need to run the command shell with elevated rights, even if you are already an administrator
If you have user that is going to need to do this frequently, you can need to create a context menu option, which can be used for any folder, on the desktop or Explorer. If you had done this previously in Windows XP, the method is slightly different, since in Windows 7 you do not have the File Types tab available in the Folder Options menu of Explorer.
There is a Microsoft KB article on how to perform this for both operating systems, but the Windows 7 method does not seem to work as advertised … for me at least. I have modified the bat file so that directory list remains open in Notepad so it can be quickly printed in addition to creating a listing.txt file in %temp%.
The steps for doing this involve:
Opening Notepad and copying the the text below:
dir %1 /a /-p /o:gn > “%temp%\Listing.txt”
start notepad “%temp%\Listing.txt”
Save the file as Printdir.bat file in C:\Windows
Create a new text file and copy the following into it:
Windows Registry Editor Version 5.00
@=”Print Directory Listing”
@=”Print Directory Listing”
Save the file as Win7PrintDir.reg (or whatever so long as it has a reg extension)
Afterwards, a right-click context menu option called Print_Directory_Listing will exist anytime you right-click a folder:
Notepad will launch and you can print the directory list from here. This is the same output if you were to use the DIR command from the command shell. Below is an example:
|Volume in drive C has no label.
Volume Serial Number is EE4D-8AE5
Directory of C:\Users\username\Documents
07/20/2011 08:42 AM <DIR> .
If you wish to omit the folder and file details, you can add the /b switch to the second line of the bat file. The resulting output would then look like:
|Any Video Converter
My Received Files
My Web Sites
My Weblog Posts
Network Monitor 3
Windows Update Allow.reg
Note, this right-click menu option is for folders only. It does not apply to Libraries, e.g. Document or music libraries. If the user happens to have some screen capture software installed like SnagIt, then you can use the scrolling window feature to capture an image of a directory.