问题
I have a simple requirement of printing text files from Windows (MS-Dos). Let's assume that my normal text file resides on "C:\Temp" folder. On the other hand, I have a EPSON TM88V receipt printer. I am able to shake hand with receipt printer connected on USB and able to print it with below command:
C:\Temp> PRINT /D:\WORKSTATION\EPSONTM-T88V C:\Temp\HelloWorld.txt
Though it's printing; but it's not cutting the paper. I need to insert those ESC/POS commands in my text file and pass it on to the printer so as to cut the paper as soon as it finishes printing my text file.
Appreciate, you help in this regard as I had gone thru sites like "http://nicholas.piasecki.name/blog/wp-content/uploads/2009/12/ESC-POS-Command-Guide.pdf" "http://www.delfi.com/SupportDL/Epson/Manuals/TM-T88IV/Programming%20manual%20APG_1005_receipt.pdf"
but unable to understand how to pass it as escape characters.
In the above links, they mentioned to use "GS V m", but pls. help how to perform it thru DOS commands.
回答1:
"GS V m" means, you have to send a controlstring to the printer containing the following hexadecimal values
0x1D 0x56 <m>
Which value to use instead of see your 2nd link, page 372ff. (maybe you need to add a LF (0x10) to complete the command sequence)
You can put those values into an file (e.g. cutnow.bin) and send it to your printer (print /D:yourprinter cutnow.bin).
How to generate this file?
I don't know of any simple way to do this in batch, I'd use Basic for that (any other programming language should do). (you need to generate this file only once) Maybe there is a simple one-line solution using VBS, but I don't speak VBS.
EDIT: For Basic it would look like that: (note that there are many different basic-dialects, so your code may be different)
open cutnow.bin for write as #1:print #1,chr$(0x1D)+chr$(0x56)+chr$(41):close #1
Remember, that you MIGHT have to add a Linefeed (chr$(10)) - sorry, can't remember, I did that kind of stuff three decades ago...
Also the last char (41) may vary - take a look at the page, I mentioned above
来源:https://stackoverflow.com/questions/15624134/how-to-use-ms-dos-commands-to-cut-paper-using-esc-pos-commands