How to perform LPR printing from W2K Pro cmd line?


John B

I have a print server with address of on my INTRANET. I can
print OK from Windows applications, and by sending a "test page" from the
usual Windows "printer" icons in Control Panel.
I have installed Print Servcies for Unix, and am currently using an LPR
device, under Control Panel, as my default printer. Fine with that.

I want to use command line printing, using the "lpr" command. Can't seem to
make it happen. Any advice appreciated.

Typically, I'll type the following at my cmd line, without success. All I
get back at the console is a "help screen" pertinent to the switches
available under the lpr command. "File.txt" IS indeed present in the
default directory, so I am not referring to a non-existent file.

lpr -S file.txt

It doesn't help to put the "-d" switch in front of "file.txt."

Thanks for any help.

Here printed is some data from my cmd window:

Pinging with 32 bytes of data:

Reply from bytes=32 time<10ms TTL=32

Reply from bytes=32 time<10ms TTL=32

Reply from bytes=32 time<10ms TTL=32

Reply from bytes=32 time<10ms TTL=32

Ping statistics for

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 0ms, Average = 0ms

Sends a print job to a network printer

Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x] [-d]


-S server Name or ipaddress of the host providing lpd service

-P printer Name of the print queue

-C class Job classification for use on the burst page

-J job Job name to print on the burst page

-o option Indicates type of the file (by default assumes a text

Use "-o l" for binary (e.g. postscript) files

-x Compatibility with SunOS 4.1.x and prior

-d Send data file first

Alan Morris [MSFT]

you need to specify the -P option
this is the printer. Normally I use the print share since I don't have to
" " the share as long as there are no blank spaces in the share name. If
you are sharing the printer with spaces in the name you will need the "".

Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x] [-d]

Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:

This posting is provided "AS IS" with no warranties, and confers no rights.

John B

Thank you. I didn't realize that I had to share the printer object.
Both of the following command lines worked, exactly the same:
lpr -S -P \\LPRNEC file.txt
lpr -S -P LPRNEC file.txt

So there is no way to stipulate the "print queue" argument without using the
Microsoft share method?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads