Use DOS to send code to open a cash drawer via USB receipt printer.

Hi Folks,
I'm looking for help on how to create a .bat file that will send a .txt file to print. The .txt file needs to contain the code to open a cash drawer that is connected to a USB receipt printer. Esentially I want to be able to open the cash drawer by clicking on the .bat file without actually printing anything.

I have created a CashDrawer.bat file that contains the code; start /min notepad /P Open.txt
The open.txt file contains the open code for the cash drawer i.e. 27,112,0,50,250. I have tried it as
CHRS$(27) + CHRS$(112) + CHRS$(0) + CHRS$(50) + CHRS$(250) and x�2 (Ascii). But neither works. It just prints as if it were text.

Any help on this is appreciated.
Shane
abainesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
USB under DOS?

Echo yourString > LPTx:

Open in new window


Where x in LPTx is your printer number.
akbCommented:
If it is printing as text then you are sending something and it is getting to the printer, so that is not the problem.
I suspect the file content is not correct.
Please post the file here and I will look at it for you and advise.
What is the printer?
abainesAuthor Commented:
Hi Akb

the printer is a Citizen ct-s2000 receipt printer. The content of the .txt file is 27,112,0,50,250 which is the open code. I have tried it as CHRS$(27) + CHRS$(112) + CHRS$(0) + CHRS$(50) + CHRS$(250) and x�2. I read that you have to convert the text to ascii or hex to get it to work but no joy so far.

Also the printer is using a USB port and is not assigned to any LPT or COM port.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

abainesAuthor Commented:
Using this converter https://www.branah.com/ascii-converter the ASCII for 27112050250 is p2ú.
akbCommented:
Please attach the file here. I am quite sure it is not correct. I can look at it for you and fix it.
abainesAuthor Commented:
Hi Akb

I've got it working now. I used a better ASCII converter and it did the job. Thanks for the assistance anyway.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
abainesAuthor Commented:
Got it working using a better ASCII converter.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.