PrintDirectory
@echo off
dir %1 /-p /o:gn > "%temp%\Listing"
start /w notepad /p "%temp%\Listing"
rem without printing : delete </p> in the line above
del "%temp%\Listing"
exit
==========================================================
=== copy what is here above and past it in Printdir.bat ==
==========================================================
•Close Notepad and click Yes to save the changes.
•In the Save As dialog box, copy and paste the following text in the File name: field (shown in below screen shot):
%windir%\Printdir.bat
•Select All Files (*.*) in the Save as type: drop down field. Then Click Save.
The Printdir.bat file has now been saved in the \Windows folder.
Next, we'll need create a shortcut to the Printdir.bat file in the Send To folder.
Create Printdir Shortcut
•In Vista, click on Start \ Run and enter the following in the Run dialog box and click OK
%APPDATA%\Microsoft\Windows\SendTo
(NOTE: %APPDATA% is an environment variable that points to your user name AppData\Roaming folder).
•In XP, click on Start \ Run and enter the following in the Run dialog box and click OK (%USERPROFILE% is an environment variable that points to your use name Documents and Settings folder).
%USERPROFILE%\SendTo
•In the SendTo folder, right click and select New \ Shortcut.
•Type %windir%\Printdir.bat in the "Type the location of the item:" field and click Next.
•Type Print Directory Listing in the "Type a name for this shortcut" and click Finish.
Now when you have the need to print a directory tree of folder contents from Windows Explorer, just right click and select Send To \ Print Directory Listing.
Much better than mucking around in the registry!
Hey What About Printing From The Command Prompt?
Yea, if you like to work at the command prompt, you can just type printdir.bat (if you created the batch file) at the prompt or enter the following command:
dir /-p /o:gn > %temp%\Listing | start /w notepad /p %temp%\Listing
The command is similar to what we used in the Printdir.bat file, except were "piping" the command together with the "|" character (found above the Enter key and holding Shift down).
By using "|" (SHIFT+\ above Enter key), it allows you to execute two commands at once. Every time you execute, it will over write the file "Listing" so you don't need to worry about deleting it.
http://www.watchingthenet.com/how-to-print-a-directory-tree-from-windows-explorer.html