Reputation: 33
I can open the cash drawer by running the following command in CMD
:
ECHO ^G>LPT1
Problem is that when I run this command from a batch file, nothing happens.
I added a timeout
to see what command actually runs and it seems like my command is automatically replaced with the following when it is run:
ECHO G 1>LPT1
How can I run my original command from a batch-file?
Thank you.
Upvotes: 0
Views: 854
Reputation: 11
This seemed to work for me:
As Josefz Said:
Run CMD Prompt as administrator and type:
echo @echo(•^>COM5>c:\Drawer.bat
Change COM5 to whatever port your printer is on. I'm using a STAR TSP100IIIECO USB Using the virtual com port supplied with the star driver.
The result when opened in notepad is:
echo > COM5
As you will see notepad cannot display the special character but running the bat successfully kicks the drawer.
I know it's an old thread but hopefully this helps someone out.
Upvotes: 1
Reputation: 30238
If I can understand, you need to send BELL
sound character (ASCII 0x07
, Ctrl+G) to the LPT1
device.
Unfortunately, my text editor (and notepad.exe
as well) brings Goto line dialogue after pressing Ctrl+G and another method Alt+07 advised here erroneously mojibakes to ASCII 0x95
. Here's my workaround: from cmd
command line, type
echo @echo(•^>LPT1>D:\bat\SO\32642290a.bat
where •
represents either Ctrl+G or Alt+07 and displays ^G
on a monitor.
Result:
Result in hexadecimal view:
Upvotes: 0
Reputation: 1
ECHO G 1>LPT1
is exactly the same as
ECHO G>LPT1
the first is correct and the second is for msdos compatability and what we mostly use. CMD fixes it as it's in a batch file rather than typed and it gets to change what you see.
However to enter Ctrl + G in a text file use CMD redirection
echo echo [ctrl+g]^>lpt1
if 32 bit use edit.com. In Edit press Ctrl P then Ctrl G (it will look different to cmd).
Upvotes: 0
Reputation: 41287
Double up the caret from ^
to ^^
as ^ alone is the escape character.
Upvotes: 2