COM1-- First serial COMmunication port, typically connected to a mouse or modem COM2 -- Second serial communications port, typically connected to a mouse or modem, the one NOT on COM1
COM3 -- Third serial communications port
COM4 -- Fourth serial communications port
AUX -- AUXiliary device, by default the same as COM1
LPT1 -- First parallel port, typically connected to the printer (LPT stands for Line PrinTer)
LPT2 -- Second parallel port
LPT3 -- Third parallel port
PRN -- PRiNter, same as LPT1
CON -- Keyboard and Display (CONsole)
CLOCK$ -- Real-time clock
NUL -- A "Bit-bucket" device that goes to nothing; anything sent to NUL will simply disappear
A:-Z: -- The drive letters
This month we'll continue with AUX, PRN, and some tricks using LPT1 in DOS and Windows.
If you need to direct the output to another port, simply substitute its name. For example, if you have an older serial printer on COM1, the command would be
DIR > COM1
Of course, DOS won't nicely eject the page from the printer, but you can also do that by using redirection to PRN. Enter the following on the command line
ECHO ^L > PRN
Type ^L by holding down the Ctrl key and pressing the letter L (CTRL-L).
This redirection to PRN is also a good way to check if the communication path to your printer is working correctly. If DIR > PRN works, then the port communication from DOS is good. However, if you have a postscript printer, this test won't work. Instead, you need to copy the TESTPS.TXT file, in the \WINDOWS\SYSTEM directory, to the printer
COPY C:\WINDOWS\SYSTEM\TESTPS.TXT PRN
Copying to the printer port has another advanced use -- printing formatted output when you don't have the application that created that output. For example, let's say you create a WordPerfect document at home, and want to print it out on a color printer at work. But the PC at work connected to that printer doesn't have WordPerfect loaded on it. Create the document at home with all the appropriate formatting for that color printer, then "print" the document to a file. This file, often with a .PRN extension, will contain all the necessary formatting and printer commands. Now at work, copy the file to the printer and the output will look like you printed it directly from WordPerfect. If the print file is called PROPOSAL.PRN, the command would be
COPY /B PROPOSAL.PRN PRN
The /B specifies a "binary" copy. This tells DOS the file is not an ASCII file and to ignore any end-of-file markers (Ctrl-Z) that are in the file. Without /B, DOS will stop the copy if it comes upon a Ctrl-Z.
1. Create a batch file in the Windows directory called DIRPRINT.BAT. Include the following line:
DIR > PRN
2. Using Explorer, right-click on C:\WINDOWS\DIRPRINT.BAT. Select Properties. Under the Program tab, select Run Minimized and check the Close on Exit box.
3. Back in Explorer, select View, Options, then the File Types tab. Scroll down and highlight the Folder type. Choose Edit.
4. Select New. Fill in Directory Print for Action, and in the application line type C:\WINDOWS\DIRPRINT.BAT. Close back to Explorer.
What we have done here is add a new action called Directory Print to the context menu for a folder (the context menu displays when you right-click on an item). Now to print a directory listing for a folder in Explorer, right-click on the open folder icon and select Directory Print.
Setting up a file action type for Folders
that will include a Directory Print option
for the right-click context menu.
If your printer doesn't automatically eject the page from the printer, add
ECHO ^L > PRN
to DIRPRINT.BAT after the DIR > PRN command. Remember the ^L is entered by pressing CTRL-L; if using DOS's EDIT program, press CTRL-P, then CTRL-L.
1. Create a batch file in C:\WINDOWS called PRNPRINT.BAT. Include the line
COPY %1 PRN /B
2. Using Explorer, find C:\WINDOWS\PRNPRINT.BAT. Right-click on the filename, select Properties, then choose the Program tab. Under the Run selection select Minimized, and check the Close on Exit box. You can also change the icon if desired.
3. Back in Explorer, select View, Options, then the File Types tab. Choose New Type.
4. In Description of Type, enter Printer. For Associated Extension, enter PRN or PS as appropriate for your printer.
5. Click on the New button.
6. For Action, enter Printer. For Application used to perform action, enter C:\WINDOWS\PRNPRINT.BAT. Click OK, then click Set Default. This makes Print (using PRNPRINT.BAT) the default action when you double click on a PRN (or PS) file in Explorer. Close back to Explorer.
Now when you want to print a PRN (or PS) file, simply double-click on it.
Next month we'll conclude our ports of call, with CON and NUL.
For more information on the Tulsa Computer Society click here