How can I print to a USB printer from the command prompt?

John Savill

July 27, 2003

2 Min Read
ITPro Today logo in a gray background | ITPro Today

A. You typically print to a parallel-port printer by copying a file to the lpt1: device. Because USB devices don't connect through an LPT device, you can't take the same approach to print to a USB printer from the command prompt. However, you have several options that will work.

If a network adapter is connected to your network, you can share the printer with another machine on the network and map the printer to LPT2 or LPT3. For example,

net use LPT2 \ /yes

shares the printer on LPT2. By sharing the printer, you can copy files from the command prompt to the printer on that port.

If you don't have a network adapter, you can install the Microsoft loopback adapter, which emulates a network adapter, create a printer share on your machine, then use the "net use" command to print to the printer share.

Alternatively, if the USB printer is your machine's default printer, you can use Microsoft Notepad to print an ASCII file to the printer. For example,

start /min notepad /P 

prints the file from Notepad to the printer, where is the name of any file that you can open in Notepad that you want to print. You don't have to include "start /min" for this technique to work, but you will want to include this command if you're printing from a batch file to minimize the command window while the batch file runs. Otherwise, the Notepad executable will steal focus away from the batch file that issues this command and could stall the batch file after printing is complete. To continue processing the batch file, you'd need to click the command window.

If none of the above techniques are suitable for your particular situation, check out the Dosprn shareware utility available at http://www.dosprn.com. Dosprn lets you print to any printer from the command line.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like