How can I print from the command window/use lpt1 etc?

John Savill

January 31, 2000

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

A. A. There are really two questions here. If you know a server anda printer share and you just need to print a file this can be done by copying tothe print share, for example:

C:> copy readme.1st \morpheusHPLaserJ

You may however need to actually use a device such as LPT1 and for this wecan use the "net use" command.

C:> net use lpt1 \10.129.210.71HPLaserJ [/p:n]

The /p:n makes the connection non-persistent.

If this fails check lpt1 is not already in use:

C:> net use lpt1
Local name LPT1
Remote name \10.129.210.71HPLaserJ
Resource type Print
Status OK
# Opens 0
# Connections 1
The command completed successfully.

And if you want to delete the existing connection perform the following:

C:> net use lpt1 /d
lpt1 was deleted successfully.

You can then use lpt1: as if its a local port for command based programs.

The Windows 2000 Resource Kit also supplies CON2PRT which can be used toconnect to a printer, e.g.

C:> con2prt /c \morpheusHPLaserJ
Connected to printer: \morpheusHPLaserJ

Which actually adds the printer as a normal printer under Printers controlpanel applet. Using /cd sets it to the machines default printer.

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