How to map a virtual COM port to a physical USB port?
Solution 1
There is a simple way to do it using standard Windows commands. Lee Harrison's link shows this command, but here's a short description. Start by making the printer shareable (from Printer Properties > Sharing tab).
Now, start a command prompt and type:
NET USE COM1: //pc_name/printer_share_name /persistent:yes
Here, pc_name
is the name of the sharing PC, and printer_share_name
is the share name you gave the printer when you set up the share.
From then on, anything you send to COM1 will be re-routed to the printer.
There is one proviso however - and it applies regardless of which method you use to get the data to the printer, hardware or software:
As your program only knows about COM1, I assume it will send plain text to the printer. Many USB-only printers do NOT understand plain text, and will just ignore it altogether. Printers that do this are called host-based printers, where the Windows graphics engine converts the page into dots on the paper, rather than letting the printer do the conversion. They are mostly the low cost printers, especially inkjets but also some lasers. Printers that do understand text need to support a language called PCL5. PCL6 printers usually also support PCL5, but PCL3 printers do not.
If you tell me your printer model I can check what language it supports.
Solution 2
We use this solution in the company.
Virtual COM port (VCP) drivers cause the USB device to appear as an additional COM port available to the PC. Application software can access the USB device in the same way as it would access a standard COM port.
Here is the Instalation Guide.
Related videos on Youtube
Needleroozer
Updated on September 18, 2022Comments
-
Needleroozer over 1 year
My question is similar to Setting up a virtual Com Port?, which has no answers.
I have software that can only print to a printer on COMx, a printer with a USB port, and a computer with a USB port but no serial ports, so the oft-suggested physical Serial-to-USB adapter isn't a solution. I'm looking for software that tricks Windows 7 into mapping a virtual COM port to a physical USB port. I'm certain that if the software I'm using sends its stream of bits to the USB port that the printer will work just fine. How do I trick the software into thinking it's printing to COMx when it's actually printing to USBx?
Internet searches only turn up drivers for some specific hardware Serial-to-USB adapter, but that's not what I'm looking for as I don't have that hardware. I found a Microsoft forum where they suggested changing the USB port's label in Device Manager, but we never found anything like what they described; perhaps that's possible with a different USB controller than we have.
-
Lee Harrison almost 9 yearsJust to clarify, you have software that can only print to a COM/LPT port. Your PC lacks LPT/Serial ports and you want to print via USB cable to a USB printer.
-
sawdust almost 9 years"I have ... a printer with a USB port" -- You neglect to mention if you have any device drivers for this printer, and what device this printer installs itself as when it's plugged in. "How do I trick the software into thinking it's printing to COMx when it's actually printing to USBx?" -- That's not how USB works. USB is a bus, so applications do not write to the USB port directly, but to the "device".
-
-
Needleroozer almost 9 yearsThis post superuser.com/questions/182655/… tried something similar. This guy superuser.com/questions/360332/… has my problem and referenced the other post. But he found and I confirmed that when you substitute COM1 for LPT1 it doesn't work.
-
Needleroozer almost 9 yearsAs for elegance, I would think a device driver that looks like a COM port but talks to a USB port would be quite elegant. I think I might start searching for tips on how to write device drivers, as there seems to be a need for this. I'm not the only one asking this question.
-
Lee Harrison almost 9 yearsI agree. Having run in to this problem before I ended up just using an adapter cable and buying a printer. There definitely is a need for a software based solution to this.
-
phuclv almost 6 yearsremoved DOS reference because there's no
net use
in DOS -
Ignacio Vazquez-Abrams almost 6 years@phuclv: Technically you're wrong, but that's not relevant here. I do otherwise agree with the edit.