Have a Question?

00358: How to capture a printer port under Windows


How to capture a printer port under Windows


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. 

windows 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. 

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 the network names needs to be shorter than 32 characters.
The mode O_CREATE needs to be added to the alias line for UNC printers. 
ALIAS P2 //server/shared_printer_name “Network Printer” CR,O_CREATE,…. 

Last Modified: 12/06/2023 Product: All  Operating System: Windows

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

Table of Contents
Scroll to Top