Setting default printer in startup scripts

Corinna Vinschen corinna-cygwin@cygwin.com
Wed May 21 11:11:00 GMT 2003


On Wed, May 21, 2003 at 10:00:01AM +0100, David Kilroy wrote:
> # 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
> 
> 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.

The backslashes are somewhat dangerous since they get evaluated as
special characters.  Why not use forward slashes instead?  regtool
supports them as registry key separator.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/



More information about the Cygwin mailing list