Printing from DOS with Windows 2000 or XP

In Windows 9x, there was a button in the printer properties to "capture printer port". Windows 2000, XP, 2003, Vista and 2008 don't have this button, so to print from a program running a Command Prompt window or an emulated DOS environment you may have to use a subterfuge,. There are three cases:

  1. the printer is a Local Printer and the print device is connected directly to a parallel port (e.g. LPT1). In this case, you should not have to anything to be able to print from a Command Prompt, from an emulated DOS prompt (command.com) or a DOS (16 bit) program.
  2. the printer is a Local Printer and the print device is connected to a USB or some other kind of port (e.g. a Standard TCP/IP port).
  3. In this case, you need to either:
  • pool the port the printer is on with the LPT1 port (see Pool in Glossary) (thanks to Steven Latus for this suggestion) or
  • create a share for the printer and map the printer to an emulated local port that DOS know about (e.g. LPT1). Do steps 1 through 7 below
  • the printer is a Network Printer or is a Local Printer on a port with a UNC name (see When installing Additional Drivers doesn't work).

Tutorial and tips in this case, map the printer to an emulated local port that DOS know about (e.g. LPT1). Do only steps 6 through 7 below.

If your computer is running Windows XP and you are not an administrator, you may not be able to map the printer to LPT1. In this case, if your DOS program allows you to specify printing to LPT2, do steps 6 through 7 and use lpt2 instead of lpt1 in step 7. If your DOS program will only print to LPT1, ask your administrator or support staff to implement the devcon work around described in the second bullet in the Resolution section of the article at http://support.microsoft.com/kb/313644.

Here's the detailed steps:

(Create a share for the local printer.)

  1. Open the printer's Property Page (see Property Page in Glossary)
  2. Select the Sharing tab
  3. Select the Share this printer radio button
  4. In the Share name: box, key the name you want to use as the printer's share name. The default is the same as the printer's name, but you may want to change it so that it is short and doesn't have any embedded spaces. This will make it easier later.
  5. Click OK (Map the printer share to an emulated local port. If you also have a Local Printer on your parallel port, use a different emulated local port (e.g. LPT2). In step 7, use this other port's name (e.g. lpt2) instead of lpt1.)
  6. Open a Command Prompt (Start, (All) Programs, Accessories)
  7. key: net use lpt1: \\computername\printersharename /persistent:yes and press Enter

for computername, use the name of your computer

for printersharename, use the share name you keyed in step 4

The /persistent:yes parameter makes the mapping of the printer to the emulated lpt1 port persistent, so you don't have to issue this command every time you logon.

loading...