I'm a former Mac user who misses being able to print a list of folder contents with descriptions, file size, and so on. Can I print the contents of a directory (folder) in Windows?
- John Tarquinto
Believe it or not, Microsoft has consistently omitted this useful feature from Windows. Luckily, it's easy to add a Print directory command with a simple two-line batch file, although be aware that this technique does not work with PostScript printers.
Because this batch file contains a special character, you need to create it at the DOS prompt instead of using Notepad. Open a DOS window and switch to the directory where you want to store your batch file (for example, you might type cd c:\windows and press <Enter>). At the DOS prompt for that directory, type copy con pdir.bat and press <Enter>. Next, type dir > lpt1 (if necessary, replace this last item with the port to which your printer is connected).
If you want to customise the directory listing, add command-line switches after the word dir in this line (for example, add /og to make the directories appear at the top of the listing).
When the line looks right, press <Enter>. Now type echo followed by a space, and then press <Ctrl>-L. (This will look like "^L" on screen, but it is not the same as typing a caret and a capital L.) Type another space, and then type > lpt1 (again, your printer port may differ). Press <Enter>. This line will cause your printer to eject the page once your directory listing has finished printing. Finally, press <Ctrl>-Z and then press <Enter> to save these commands to the batch file. You can now close the DOS window.
To set up your batch file so that it runs easily in Windows 95, start Windows Explorer and choose View--Options. Click the File Types tab and select File Folder (not Folder) from the list of Registered file types. Click the Edit button. In the Edit File Type dialogue box, click New to create a new action. In the Action box, type something like Print directory. In the Application used to perform action box, type c:\windows\pdir.bat (adjust the path as needed). Then click OK and close each of the remaining dialogue boxes.
Now right-click a folder in Explorer's left pane, and choose Print directory from the resulting menu to test your new command. (If you right-click a folder in the right pane, the printed list will show only the contents of the folder containing the folder you clicked.) When the batch file is finished, you'll see a DOS window open on your screen; if instead you see a DOS prompt displayed full-screen, press <Alt>-<Enter> to make it a window.
To keep this window out of the way in the future, click its control menu icon (at the far left end of the title bar) and choose Properties from the menu. From the Run drop-down list in the resulting dialogue box, select Minimized. Then check Close on exit and click OK. Close the DOS window. From now on, you won't have to fuss with the DOS window whenever you run your new Print directory command.
To use the batch file in Windows 3.1, you have to do a little typing each time. Start the Windows File Manager and select a folder in the left pane. (As in Windows 95, if you select a folder in the right pane, the list will show the directory containing the selected folder.) Choose File--Run. Press <Home> to move the cursor to the beginning of the command line. Type pdir (or whatever you named your batch file), followed by a space, leaving the directory name at the end of the command line. Then press <Enter>. (If that seems like too much typing, you can easily automate most of these steps with a Windows Recorder macro.) The DOS window will flash on your screen, but it should close automatically as soon as the batch file has finished running.
- Scott Dunn
With a simple batch file, add this Print directory command to the menu
|
Category: Win95
Issue: Aug 1997
Pages: 168
|