4

I have Cygwin on a Windows 7 machine. In my .bashrc file, I have tried

export PRINTER=\\\\myPrintServer\\myPrinter

Escaping the backslashes, which, when I type $lpr -D, gives me

Windows Printer Name = '\\myPrintServer\myPrinter.lnk'
lpr: printer error: can't open '\\myPrintServer\myPrinter.lnk' for writing: The printer name is invalid.

But I didn't type the .lnk there and don't think I want it. If this is the problem, how do I get it to not append .lnk? If the problem is something else, I'm all ears.

studiohack
  • 13,477
mring
  • 1,097

2 Answers2

0

I use enscript to format my printouts, but since it uses lpr this clue can help you

after learning that some printers are accessed by the name you find in the windows add printers menu I had success with a script that wrapped these two lines

export PRINTER='HP LaserJet Pro M118-M119' enscript --media=Letter -G -h "$@"

It is good to use cygwin's lpr -D command to display a list of printer names that you can set to your PRINTER environment variable, which you are doing!

By the way, "lpr" in the cygwin cygutils-extra package ( not installed by default ) I know you knew that, but other readers might not.

0

I'd try

net use lpt1 \\myPrintServer\myPrinter

then

export PRINTER=lpt1
lpr -D

If that didn't help I'd try

/cygdrive/c/WINNT/system32/lpr -S server -P printer filename

after enabling Unix (LPD) printing on the server.