Assume we have a binary file with ESC/P commands, barcode.bin.
C:\>type barcode.bin > COM1
C:\>copy barcode.bin COM1
C:\>copy barcode.bin USB001
If one these work for you, congratulations! They didn't work on my Windows 7 64 bit OS. Windows 7 does not assign COM port to USB device. Checking the printer properties shows that it is connected to port USB001. But executing the last command above does not work. Windows 7 DOS command does not recognize USB001 as a device. I have to do this instead.
C:\>NET USE LPT1: \\COMPUTERNAME\PRINTERNAME /PERSISTENT:YES
C:\>copy barcode.bin LPT1
TADA.. It works.
But the problem is, if I have no internet connection / LAN, the shared printer sometimes disappear. Don't know how to solve this.
ReplyDeleteThis comment has been removed by the author.
DeleteThere is no straight forward method to solve this on Windows. I think it is a windows bug.
DeleteI'd suggest you buy a network print server device (a device that has a USB port for the printer and Ethernet port). It's a small device and not expensive. You connect this device to the printer USB port, and then connect the device network port to the LAN network. You need to configure the device ip address, port name, etc.
After that, you can use Line Printer Remote (LPR) service in Windows 7. By default this is feature is not installed, but you can install this feature by going to the Program and Features and then select Turn Windows Features on/off. After you turn on the LPR feature, you can start printing using the LPR command.
Please see this post:
https://codingsnapshot.blogspot.com/2018/10/printing-barcode-from-command-line-to.html
I use this setup to solve the problem you mentioned.