This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Setting default printer in startup scripts


I've been using enscript for a while. Because lpr defaults to prn, I
explicitly specify the printer to use every time via a shell script.

I've now modified my .bash_profile to set the environment variable PRINTER
to the windows default printer as defined in the registry (see below). Would
it be worth adding this to cygwins .default/skel files?



Dave.


# Define default printer
if [ $OS = Windows_NT ]; then
  PRINTER=`regtool get '\user\Software\Microsoft\Windows
NT\CurrentVersion\Windows\Device'|sed 's?\([^,]*\),.*?\1?g'`
else
  PRINTER=`regtool get
'\config\System\CurrentControlSet\Control\Print\Printers\Default'`
fi

95/98/ME source:
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B143274

NT/2000 sources:
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b271257
http://techsupt.winbatch.com/TS/T000001031F14.html

Note: I haven't tested the above much. It works on my NT box with a network
printer, and I've verified an ME box has the appropriate registry entry.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]