Posted by & filed under Windows / Server.

This is a useful little tip if you wish to print a list of files in a directory.

To print directly, type the following at the command line:

C:\>dir c:\dirname /b

To print to a text file, type the following at the command line:

dir c:\dirname /b > filename.txt

To print a list including subdirectories, type the following at the command line:

cmd /c tree c:\dirname /f > lpt1

If you want to print using a shell extension (context menu) type the following into notepad and save it as print.bat and place it in the windows directory (usually c:\windows\).

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

Then add “Print Directory Listing” to your context menu. Open the Folder Options tool in Control Panel, select the File Types tab -> In File Types column select File Folder. Click on Advanced -> New -> Specify a name for the action and the point it to the print.bat file you created.

(No Ratings Yet)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>