Microsoft KB Archive/246422

= Printing from INTERIX =

Article ID: 246422

Article Last Modified on 10/30/2006

-

APPLIES TO


 * Microsoft Interix 2.2 Standard Edition
 * Microsoft Interix 2.2 Standard Edition
 * Microsoft Interix 2.2 Standard Edition
 * Microsoft Interix 2.2 Standard Edition

-



This article was previously published under Q246422



SUMMARY
This article explains the process of printing from INTERIX.



MORE INFORMATION
Printing from an INTERIX computer is handled through the LP command. The LP command is a shell script that calls the Win32 command-line program Print.exe. If you can print a file by using Print.exe at an MS-DOS prompt, you can print a file by using the LP command. The first step is to make sure that your printer can print in the Win32 environment, using Print.exe.

NOTE: The instructions in this section are based on Microsoft Windows NT 4.0. If these instructions conflict with the documentation for your computer, follow your computer documentation instead.

Setting Up a Printer
To set up a printer that is attached to your computer, use the Add Printer Wizard.


 * 1) Click My Computer.
 * 2) Double-click Printers and then double-click Add Printer.
 * 3) Complete the information requested by the Add Printer Wizard.

You do not need to make this printer the default printer for your system, though you can if you want. The default printer for LP is determined by the value of the PRINTER or LPDEST environment variables in the INTERIX environment.

If other users on the network are going to use your printer, you will need to share it. See the instructions in the next section.

Sharing Your Printer
First, see whether your printer is currently shared. At the command prompt, type the command net view \\computername, where computername is the name of the computer connected to the printer. Print indicates a printer. If you do not see a printer, then the computer is not sharing the printer with the rest of the network. To share a printer, you need to grant the necessary permissions.
 * 1) Double-click My Computer.
 * 2) Open the Printers folder.
 * 3) Select the printer, which has already been configured to work with Windows NT.
 * 4) Right-click the printer, and then click Properties.
 * 5) Click Sharing, and then click Shared.
 * 6) Type a share name for the printer in the Name box.
 * 7) Click OK.

Connecting to a Shared Printer
If the printer is already shared from another computer, you only need to set it up for your system.


 * 1) Double-click Network Neighborhood and locate the computer that shares the printer.
 * 2) Double-click the printer, and then double-click the Printers folder.
 * 3) On the File menu, click Install.

Specifying a Printer
There are two ways to specify a printer by using the LP command.


 * To specify the printer for a single command, use the -d option.
 * To specify the default printer, set the LPDEST environment variable or PRINTER environment variable.

The -d Option
The -d option to the LP command specifies the printer. Since the argument to -d is passed to Print.exe, it has to be in universal naming convention (UNC) format, \\computername\sharename. The backslashes must be escaped to prevent interpretation by the shell.

Both of these LP commands print the file Testfile.txt on the printer with the UNC name \\computername\printername:

LP -d \\\\computername\\printername testfile.txt

LP -d '\\computername\printername' testfile.txt

If the printer is attached to your computer, you can just specify the printing port instead:

LP -d lpt1: testfile.txt

LP -d lpt2: testfile.txt

The Environment Variables
If no printer is specified on the command line, the LP command checks the value of the environment variable LPDEST. If LPDEST is not set, the LP command uses the value of the environment variable PRINTER.

For our example, we assume you are setting LPDEST. This value is passed to Print.exe, so it must be in UNC format, escaped for the shell.

You can make printername your default printer with this command:

export PRINTER=\\\\computername\\printername

In the C shell, type:

setenv PRINTER \\\\computername\\printername

Other Printing Services on Windows NT
There are other printing services available on Windows NT, but they do not work with the INTERIX LP program. They are intended to allow Windows NT-based computers to share printing services over a heterogeneous network. The other computers are presumed to be running an open systems operating system, such as Linux, BSD, or SVR4.

LPR - A Win32 Print Spooler

The LPR command sends print jobs from your Windows NT-based computer to an open systems computer that is running a line printer daemon (LPD). The Microsoft TCP/IP Printing service must be installed before this works.

LPQ

LPQ is a Win32 program to view the status of a remote LPD queue.

LPDSVC

LPDSVC is a Windows NT service that prints jobs coming from a client on an open systems computer.

Keywords: kbinfo KB246422

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.