Search
Close this search box.

HOWTO: Print to a USB Printer from DOS in Windows XP

Scott Hanselman has a post on his weblog about getting a shared network printer to work in DOS.  That’s not really all that tough and actually got me thinking about a similar experience I had recently.

In my previous job I had the great misfortune of having to support a DOS based point-of-sale application.  When you sell stuff, you need to give out receipts.  We used the nice little T-88’s from Epson.  Very nice little units that were fairly reliable.  When it came time to buy some more, I chose to go with the USB interface rather than parallel because hey, it is the 21st century after all. 

What I forgot about was the fact that DOS doesn’t know a gosh darn thing about USB.  With parallel, it’s easy.  IJW.  Even if you want to use a network printer it’s dead simple.  Prior to Windows XP you can just go into the printer properties and there’s a little button there to capture the printer port and map it to a network printer.  In XP you have to know the NET USE command to make it go as the GUI interface disappeared.  Odd that.

But what do you do when you don’t have the printer connected to the parallel port and you’re in a stand-alone type of scenario?  Now, the first thought you have is that you’ll just share the printer and then use the old NET USE command to capture the printer port and map it to the USB printer.  QED.  This works.  Well, at least it works in the office.  Where I happened to have the POS computer plugged into the network to load the software and apply updates etc.  But once you disconnect the network cable, the network goes away and so does your shared printer.  It doesn’t matter that the shared printer is connected to that very machine because as far as Windows is concerned it’s on the network and the network has packed it in.

My initial solution to at least get the new store up and running was to simply give them a small 4 port hub to plug into.  Windows doesn’t care if there are other computers to talk to on the network, so long as the network has punched in and is on the clock.  This, as you are no doubt thinking, is a less than an optimal solution. 

It’s funny the things you forget about or at least put into the deep-archive, tape backup of the mind.  I put the issue aside for a few days but it was always nagging at my mind and then one day my wet-ware mainframe finally dredged up something from the archive.  LOOPBACK ADAPTER it flashed across my mind.  Five or six years ago that would have been the first obvious solution.  Sure enough, it’s still around in XP. 

For the kids out there, the Microsoft Loopback Adapter is basically a software based network adapter that simulates a live network.  It was designed for this very purpose.  Testing network functionality in the absense of a live network.  Anybody out there remember the PWS on Win95?  (that’s personal webserver – and you could even do ASP on it) Packets basically travel up and down the TCP/IP stack through the adapter and get fed right back to you.  So now, as far as Windows is concerned, the network is not only clocked in, but willing to work overtime if neccessary.  Sweet.

So here, for your edification and reading enjoyment are step-by-step directions on making this work.

In order to print from DOS in an offline environment like the stores, you will need to do a couple of things.

1)      Install the Microsoft Loopback Adapter

a)      In Control Panel, double click on Add Hardware.

b)      Click Next

c)      When the scan finishes, select “Yes, I have already connected the hardware”

d)     Click Next

e)      Scroll to the bottom of the list and select “Add a new hardware device”
Click Next

f)       Select “Install the hardware that I manually select from a list (Advanced)”

g)      Click Next

h)      Select “Network Adapters”

i)        Click Next

j)        Select “Microsoft” under the Manufacturer list.

k)      Select “Microsoft Loopback Adapter” in the Network Adapter list.

l)        Click Next

m)    Click Next

n)      Click Finish

2)      Configure the Adapter

a)      The loopback adapter is a virtual network adapter and can be configured the same as a regular network card.

b)      Set the adapter to have a static IP address such as 192.168.1.1/ 255.255.255.0

3)      Share the printer.

a)      I recommend you use a share name that you will remember.  I used “Printer” in the new machines that are already deployed.

4)      Capture the printer port.

a)      NET USE LPT1: \\[Computer Name]\Printer /PERSISTENT:YES

Now, not that I like to encourage this type of behaviour, but if you have done the above and still can’t get it to print, you may find some help through one of the articles located here.

Dave
Just because I can…

This article is part of the GWB Archives. Original Author: David Totzkie

Related Posts