To print a directory / file listing in Windows 95

Here's how you print a directory listing from a DOS window during a Win95 session. Go into the directory you want printed by using the CD command (or any other way you have of moving among folders). Then type dir > Prn and press ENTER. This sends a directory listing to your printer.

A more elegant solution (which takes more time and hassle to set up but is more flexible and quicker later on) is to create a Print Directory menu choice that you can use inside Windows Explorer. Here's how to do it:

  1. Using Notepad, create a batch file named Printdir.bat that contains these two lines:
    dir %1> c:\temp\dir.txt
    "c:\program files\accessories\wordpad.exe" c:\temp\dir.txt
    and save it on your C: drive. If you use WordPad as your editor, be sure you choose "Save as type:" Text Document and double-check that the extension is .BAT.
    (NOTE: This batch file assumes you have a folder called c:\temp)
  2. Open Explorer, choose View, and left-click Options.
  3. Left-click the File Types tab and find File Folder in the Registered File Types list.
  4. Select the File Folder and left-click the Edit button.
  5. Left-click New and then, where there's an empty Action slot, type print this directory. For Application Used To Perform, type c:\printdir.bat.
  6. Left-click OK until you've exited Explorer.

Now, when you open Explorer and right-click any folder, you'll see the choice Print This Directory. If you select it, the batch file will execute a DIR command and bring up the directory listing in WordPad, where you can easily format and print it.

If using this custom feature leaves an unwanted DOS window open, you can modify the properties for Printdir.bat (by right-clicking the open DOS window's title bar, then right-clicking Properties) and check the box that says Close On Exit. While in the Properties dialog box, consider setting it to Run Minimized rather than Normal Window.

With either of these techniques, you also can use the DIR command's powerful parameters. For example, DIR/O:N would create and alphabetized list of file names, and DIR/S would include all the files in the subdirectories. For more information about the optional features of DIR, type dir/? At a DOS prompt.

Submitted by Mitch Katowitz

Return to Home