Main Menu

KB#00358-How to capture a printer port under Windows NT, Win2000, XP, Vista

Title:

How to capture a printer port under Windows NT, Win2000, XP, Vista

Description:

To capture a printer port under Windows NT so that you can use a /dev/lptx config.bbx alias line, you must first issue the following from the command prompt: 

NET USE LPT2 \\server\shared_printer_name /persistent:yes 

where 'server' is the hostname of the server where the printer actually resides. Under Vista using the net use command to capture a local LPTx port to a network UNC shared printer may require the addition of the USER and PASSWORD being passed: 

NET USE LPT2 \\server\printer /user:user_name password /persistent:yes 

Configure the printer in the config.bbx using: 

ALIAS P2 LPT2 "server queue" CR,... 

The /dev/ that is needed in earlier version of Windows usually will not work under Windows 98/NT/2000/XP and should be left off. However, occasionally we have seen that included the '/dev/' doesn't have an effect either way. 

Vista requires the mode=O_CREATE to open devices directly, see KB01164 for additional information. 

ALIAS P2 LPT2 "server queue" CR,O_CREATE,.... 

The /persistent:yes is supposed to ensure that a registry entry is made and the capture will persist through a restart of the machine. If the connection to a printer doesn't remain after rebooting, create a batch file that contains the above NET USE line. Placing this batch file in the startup group will ensure that the batch file is executed automatically after rebooting the computer. 

************************ 
If the network has a Windows NT/2000 Server and Windows NT/2000 Workstations then Visual PRO/5 allows using UNC (Universal Naming Convention) in the ALIAS line so the CAPTURE of the port is not necessary. To use UNC in an alias line: 

ALIAS P2 //server/shared_printer_name "Network Printer" CR,..... 


Note that the slashes in the above ALIAS are forward slashes. Please also note that this sometimes does not work using any other Windows versions except NT/2000. In the Windows Network Neighborhood they are backslashes. Visual PRO/5 will return an Error=12, tcb(10)=13 if you use backslashes and then attempt to OPEN(chan)"P2". 

Vista requires the mode O_CREATE for UNC printers. 

ALIAS P2 //server/shared_printer_name "Network Printer" CR,O_CREATE,.... 



Last Modified: 01/18/2008 Product: Visual PRO/5 Operating System: Windows NT

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN ProfileVisit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel