Redirect LPT1 to Default Printer

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

☠ MASQ ☠Commented:
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.

ednetmanAuthor Commented:
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.
☠ MASQ ☠Commented:
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
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

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.

ednetmanAuthor Commented:
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.
ednetmanAuthor Commented:
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.
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.
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
☠ MASQ ☠Commented:
Now that one I like!  (makes notes for future use) M :o)
ednetmanAuthor Commented:
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.
ednetmanAuthor Commented:
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?
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
PAQed, with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kevin MyersConsulting EngineerCommented:
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.


ednetmanAuthor Commented:
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?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Printers and Scanners

From novice to tech pro — start learning today.