PRINTING FROM SUNTYPE USING WINDOWS XP...

Printing from DOS Programs

Windows provides support for printing from DOS programs. It offers a pass-through scheme that receives output from DOS programs and sends it directly to the printer. DOS programs have no access to Windows printer drivers, so each DOS application must have its own driver for any printer that it prints to.

 Windows intercepts the DOS output and spools the output as it does printer output from Windows applications (that is, Windows stores the output and then sends it to the printer). This provides more flexibility in printer management and avoids the possibility that a DOS program will interfere with an active print job from another program.

Determining the Printer Port

DOS programs identify your printer according to the port to which the printer is attached (LPT1, LPT2, LPT3, COM1, COM2, COM3, or COM4). To find out what port a printer is attached to, follow these steps:  

Select Start | Printers and Faxes (or Start | Control Panel | Printers and Other Hardware | Printers and Faxes) to open the Printers and Faxes window.

Right-click the desired printer and select Properties to open the printer's Properties dialog box.

Click the Ports tab to see a list of the ports, and look down the list for the first one whose check box is selected. If the dialog box has no Ports tab, look on all the tabs--the contents of the dialog box depend on the printer driver.  

Click OK to close the printer Properties dialog box.

Printing to a Network Printer

DOS programs can also print to network printers. Windows captures the output from a simulated printer port and then spools the printer output through the network in the same way that printer output is spooled from Windows programs.

 All printers are not created equal. Their capabilities depend both on the printer hardware and on the printer driver software. You may notice anywhere from subtle to enormous differences between the printer-related dialog boxes you see in this book and those you see on your computer. If you don't see a feature we mention here, your printer probably doesn't have it. Check your printer's manual to prevent yourself from wasting a lot of time on something that will simply not work. 

To print from a DOS program to a network printer, follow these steps:  

Determine the pathname of the printer by displaying its Properties dialog box (as described in the previous section). If you see a Ports tab, look on that tab at the bottom of the list of ports for the pathname (you may need to drag the Port column divider to the right to make the entire name visible). The pathname is in the format \\computername\printername, where computername is the computer's name on the LAN, and printername is the printer's share name.  

Close the printer's Properties dialog box.

Choose Start | All Programs | Accessories | Command Prompt to open a Command Prompt window.

Type the following command and press ENTER key. Replace n with the LPT number you want to use (if you already have a printer on LPT1, use LPT2), and \\computername\printername with the printer's pathname.

net use lptn: \\computername\printername /persistent:yes

Now you can print from your DOS program to the LPT port you specified. When you are finished printing, type this command in the Command Prompt window: net use lptn: /delete

When you print from a DOS program to a spooled printer, either local or networked, Windows has no reliable way to tell when the DOS program is finished printing. If your program doesn't print anything for several seconds, Windows assumes that it's finished. This occasionally causes problems when an application prints part of a report, computes for a while, and then resumes printing, because Windows can interpret the pause in printing as the end of the print job. If this is a problem, use a locally connected printer and do not configure the printer to spool DOS print jobs.

 Back to Main Tech Notes Page


HomeProductsTech NotesContact Us