Solved

Problem with echo of escape codes in batch file

Posted on 2000-04-17
5
1,683 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
  • 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 200 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
is there an export feature for easy reading in task scheduler 9 82
Undelete of overwritten files 27 81
Lot of troubles with windows 10 7 52
server core and windows updates 3 38
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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