Skip navigation

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

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

C:\> copy readme.1st \\morpheus\HPLaserJ

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

C:\> net use lpt1 \\10.129.210.71\HPLaserJ \[/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.71\HPLaserJ
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 to connect to a printer, e.g.

C:\> con2prt /c \\morpheus\HPLaserJ
Connected to printer: \\morpheus\HPLaserJ

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


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish