Redirect LPT1 to Default Printer

Posted on 2003-11-03
Last Modified: 2012-06-21
A department in our corporation uses and old DOS type program for some of its more critical functions.  The way the program is written, it will only print to LPT1.  The department has several hundred workstations and many different printers, so pointing LPT1 to a single printer is not an effective solution.  I am looking for a way to have LPT1 automatically redirect to the default printer for that particular workstation.  I don't mind installing a small client on the desktop to accomplish this.  Has anyone had a similar issue, any ideas?  Can the mode command be used?

Windows 2000, SP3 printing to varying models of HP LaserJet and Lexmark printers connected directly to the network with their own IP address.
Question by:ednetman
  • 6
  • 3
  • 2
  • +4
LVL 62

Expert Comment

by:☠ MASQ ☠
ID: 9674085
You should be able to redirect by capturing the printer port in printer settings

This Googled from (

Q:  I need to print from a DOS application. How can I do that?

The DOS program only can print to LPT1 or LPT2 of the local printer port of computers.  Therefore, you need to capture printer port and redirect the LPT1 to a network printer port for the Print Server.

The procedure for windows 2000 and XP workstations is not the same with the procedure for windows 95/98/NT/ME.

For windows 95/98/NT/ME network, you need to share the printer from one computer so another computer can do the redirection.  It  means one of your computer needs to be on for other computers can print the DOS program.  In our example below, machine B is the windows 95/98/NT/ME machine that needs to print DOS application.

First of all, make sure you have one machine (suppose machine A) print fine from a windows application to the print server device.  Then click on Start button.  Select Settings.  Select Printers.  Right click the mouse on the printer icon and then select Sharing.   If you do not have the sharing option, you need to enable the File and Printer sharing option in Network of Control Panel.
Under Sharing, enable the sharing and assign a share name (suppose HP4000sharing) then click OK.  You will see a hand underneath the printer icon.
Find out  the computer name by going to Network in Control Panel.  Click on the Identification tab.  You will see the computer name.  Write the computer name down.  Here in our example, we use machine A as the computer name.
Go to the machine (suppose machine B) that needs to print the DOS application.  Click on the Start button.  Select Settings.  Select Printers.  Right click the mouse on the printer icon and select Properties.  Click on the Detailed tab.
Click Capture Printer Ports button.  Make sure you select LPT1.  In path, type \\ComputerName\ShareName which computer name and Printer share name are the names in step 2 and step 3 above.  In our example, it is \\machine A \HP4000sharing.
Check the option 'reconnect at logon'.  By doing so, you will save the settings even you reboot your system.
Click OK.  And click Apply or OK button.
Now you can test print your DOS application from your computer machine B.

If your machine B runs windows 2000 or windows XP, you do not need Machine A share the printer.  Have the windows 2000 and XP share the printer and redirect LPT1 to the computer itself.  For example, in step 5, machine B can redirect LPT1 to \\machine B \HP4000sharing directly.


Author Comment

ID: 9674139
Good try, but not quite what I was looking for. That would require mapping LTP1 on several hundred workstations. Since I don't know what printer each user has set up, this could take days to deploy. I was thinking of some king of DOS command or clinet that I could push remotly using Ghost, set a shortcut in "All Users" startup to redirect LPT1 to whichever printer this user has selected as their default. The users have the ability to change their default printer amoung the list of installed printers we provide, however they cannot add or delete them.  this is especially usefull when a printer goes down.
LVL 62

Expert Comment

by:☠ MASQ ☠
ID: 9674283
How about creating a utility that finds the default printer & then remaps it?

Detect default printer ....

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")

sOSversion = GetOS() 'Return either WinNT/2K or Win9x/Me

If sOSversion = "WinNT/2K" Then
sOldDefPrtr = oShell.RegRead(_
"HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion" & _

Elseif sOSversion = "Win9x/Me" Then
sCurrentConfig = oShell.RegRead(_
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\IDConfigDB" & _
sPrtrName = oShell.RegRead(_
"HKEY_LOCAL_MACHINE\Config\" & sCurrentConfig & "\System" & _
sOldDefPrtr = oShell.RegRead(_
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print" & _
"\Printers\" & sPrtrName & "\Port")

sNewDefPrtr = "Undetermined! (Old default printer could not be
End If

Expert Comment

ID: 9682557
My solution should work for you but if you already have a hundred computers deployed each one will probably have to be updated.  I don't know how to push printer settings down to workstations but if you can install or reconfigure workstations using ghost  then this might work.

On the computer with the default image, go to the properties window for each printer on your network and perform the following steps.  

1. Go to the ports tab and check the "Enable Printer Pooling" checkbox.  

2. Now in the list of ports check LPT1.  You should now have two ports checked, the orignal port for the network printer and the LPT1 port.  

The concept here is a printer pool is a collection of printers that are exactly the same and when printing to this type of printer the first available printer is chosen to be printed to.  By performing the above steps you have created a bunch of printer pools that consist of one printer and an LPT1 port.  When a job is directed to LPT1 and since there is no printer there, it will print to the "other" printer in the pool.

So when a user selects their default printer, they will have the ability to print to LPT1 without you having to know the default printer name.

Hope this helps.


Author Comment

ID: 9683918
Wow!  That's a cool trick.  Problem is that the users can select their default printer so I would not know which printer to add the print spool to.  I think I am looking for a batch file, VB Script, or executable that can gather the profile specific settings and make the changes for me.

Author Comment

ID: 9719429
The printer pooling trick works.  Does anyone know of a batch file or VB Script that can enable printer pooling and then select LPT1?  I know the port names for all the existing printers, however the IP adresses vary widely.

Expert Comment

ID: 9723046
I found this on Microsoft's technet, it uses VB scripting to get things done.  Maybe some of the information found here could be used as a basis to push down your printer settings.
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Expert Comment

ID: 9733794
Something we used to do on an NT network a few years back might be useful for you in this situation. If you can map network drives, or print to network printers, this should work for you.


This command allows you to map a local drive -or devicename- to a network resource. In this instance, you'll want to use the following syntax:

NET USE [devicename] \\servername\sharename

"servername" can be any computer on the network which is sharing a resource, in this case a printer. Since we're mapping printing, you can issue this command as follows:

NET USE LPT1 \\servername\sharedprinter

You can check the existing mappings by typing NET USE at the command prompt. Additionally, you can delete mappings using the following:

NET USE [devicename] /DELETE

If you wish a mapping to persist after logon/reboot, you can use the PERSISTENT keyword as follows:

NET USE LPT1 \\servername\sharedprinter /PERSISTENT:YES

To make this a little easier for you on a network, you can add the command syntax to your logon script. So, for example, you could have lines in logon.bat (or whatever the sript name) as follows:

NET USE LPT1 \\servername\sharedprinter /PERSISTENT:YES

Then include the appropriate shared printer in the logon script for each group of users so that they can print to the correct network printer.

For the users, this is completely transparent: their applications will print to LPT1 and the output will be automatically routed to the network printer.

This solution works for -most- applications. Of course you will wish to try this first in a test environment.

Good luck, and post back to let us know how it goes!


Daniel Mann
Terran Enterprises Corp
LVL 62

Expert Comment

by:☠ MASQ ☠
ID: 9733857
Now that one I like!  (makes notes for future use) M :o)

Author Comment

ID: 9811917
The printers are not shares, so I can't make it map back to itself.  Does anyone know how to share a printer or enable printer pooling from a batch file or VB Script?  They all have a printer with the same name and same port name, although the IP for that port will differ.

Author Comment

ID: 9851573
Either option will work.  If printer pooling were enabled and the script could make it watch LPT1 as well as the IP address or if we can share the printer with a generic name, then we would be ready to go.  Is there any DOS command, VB Script, local or domain policy that be used to enable this?
LVL 38

Expert Comment

ID: 10840738
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Please leave any comments here within the next four days.


EE Cleanup Volunteer

Accepted Solution

modulo earned 0 total points
ID: 10872159
PAQed, with points refunded (500)

Community Support Moderator

Expert Comment

ID: 11898650
I'd just like to add that I need a solution to the same problem as the original poster, and that none of the answers provided so far fit the bill.  Key requirements: 1) The solution must redirect printing to the DEFAULT printer, whatever that happens to be on the specific machine in question.  2) It must NOT be necessary for the printer in question to be set up as a NETWORK or SHARED printer, even only on the specific machine itself.  I.e. it must work for USB or pure network printers (e.g. TCP/IP ports, not print servers on other machines) without being forced to define a new share.  3) The solution must NOT require specification of a specific printer name that might DIFFER on every machine where the solution is implemented.



Author Comment

ID: 11898782
I never was able to find a solution.  We have just been fixing them one at a time as they complain.  I fixed the image so that printer pooling is enabled on the printer that all users have.  It isn't the best solution, but what else can i do?

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XenMobile airprint policy 3 87
HP LaserJet CP4025 print quality issue 5 47
Printing causes application to got into "not responding" 6 45
Printer Settings 3 91
This seems to be a very common error related to the Samsung printer driver. First, this is the error we're talking about: Log: System Type: Error Event: 7000 Agent Time: 3:37:24 am 22-Apr-09 Event Time: 6:07:24 pm 21-Apr-09 UTC Source: Se…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now