Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with echo of escape codes in batch file

Posted on 2000-04-17
5
Medium Priority
?
1,738 Views
Last Modified: 2013-12-21
The following line in a batch file works in Win98 but not in WinNT.

echo &l0O&l8D(s12H >> TEST.UTV

The first character after the echo is the Escape character (ascii 27).
The purpose is to add some printer-format codes to a file to switch from portrait to landscape, but on WinNT I get the response:

The name specified is not recognized as an internal or external command.

0
Comment
Question by:hansbos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:percy_k
ID: 2722217
Try this

echo ^[^&l0O^[^&l8D^[(s12H >> TEST.UTV

Percy
0
 

Author Comment

by:hansbos
ID: 2725847
Percy,

Thanks for your comment. I tried your command but I didn't get the escape codes in the file.
I already made a bypass by using the type command in combination with a file with the printer codes, but I was just curious if there was a way to echo the escape codes.

Hans
0
 
LVL 2

Accepted Solution

by:
percy_k earned 800 total points
ID: 2726096
Hans,

The error you got is come from the character "&" which will confused the system to assume the echo is end and submit the command next to "&"

Add a "^" in front of the "&" can drive the system to recongize "&" as character.

I try this in my machine and can generated a test file with the script you want. Please tell the detail of the error.

Anyway, if you want to echo a "&" to a script. You must add a character "^" in front of it. "^"= ctrl-6

percy
0
 
LVL 23

Expert Comment

by:Tim Holman
ID: 2726253
NT doesn't provide ANSI support (flashy escape codes) in its command line.
However, you could configure autoexec.nt / config.nt to include the ANSI driver, open a DOS session, and then use escape codes to send to your printer.
0
 

Author Comment

by:hansbos
ID: 2726273
Percy,

Thanks. The "^"-character worked.

Hans
0

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question