We need to map a USB printer to a LPT port so that Control under windows can print to it. This can be achieved by sharing the printer, and then mapping it to a LPT port. This gives several problems. one is that windows will refuse to connect/print to the share if your network connection is not up. The other is that it does not remember the connection after a reboot.
In order to print from DOS in an offline environment like the stores, you will need to do a couple of things.
- Install the Microsoft Loopback Adapter
- In Control Panel, double click on Add Hardware.
- Click Next
- When the scan finishes, select "Yes, I have already connected the hardware"
- Click Next
- Scroll to the bottom of the list and select "Add a new hardware device" Click Next
- Select "Install the hardware that I manually select from a list (Advanced)"
- Click Next
- Select "Network Adapters"
- Click Next
- Select "Microsoft" under the Manufacturer list.
- Select "Microsoft Loopback Adapter" in the Network Adapter list.
- Click Next
- Click Next
- Click Finish
- Configure the Adapter
- The loopback adapter is a virtual network adapter and can be configured the same as a regular network card.
- Set the adapter to have a static IP address such as 10.0.30.1/ 255.255.255.0
- Share the printer.
- It is recommend you use a share name that you will remember. I used “Docket” for thermal docket printers, and "laser" for full A4 laser printers.
- Capture the printer port.
NET USE LPT1: \\[Computer Name]\Printer /PERSISTENT:YES
[Computer Name] is either the computer's name or the IP address you mapped to the loopback adapter. Once you have done the above and tested it, store the command into a text file in your CCDIR and name it setprnt.bat. Create a shortcut in your Program Files->Startup menu to this file. Reboot the computer and make sure printing still works.
A related but different configuration is if you actually want to connect to a password protected windows share. The command is
* NET USE LPT1: \\[Computer Name]\Printer [password] /PERSISTENT:YES /USER:[username]
