PC Review


Reply
Thread Tools Rate Thread

Bug in command prompt's ECHO?

 
 
=?Utf-8?B?ZmFi?=
Guest
Posts: n/a
 
      19th Jun 2007
I am trying to echo a message and pipe it to another program. The problem is
that the message contains spechal characters.

The caret ^ can be used as escape for special characters. So, if I type

H:\>echo ^<

I get the correct output

<

The same happens if I redirect output to a file

H:\>echo ^< > test.txt

test.txt contains the right message.

But redirection to pipe seems to be broken.

H:\>echo ^< | more
The syntax of the command is incorrect.

What's the problem? Is there a solution or workaround?
 
Reply With Quote
 
 
 
 
Pegasus
Guest
Posts: n/a
 
      19th Jun 2007

"fab" <(E-Mail Removed)> wrote in message
news:88238844-87BC-4CB1-B6E4-(E-Mail Removed)...
>I am trying to echo a message and pipe it to another program. The problem
>is
> that the message contains spechal characters.
>
> The caret ^ can be used as escape for special characters. So, if I type
>
> H:\>echo ^<
>
> I get the correct output
>
> <
>
> The same happens if I redirect output to a file
>
> H:\>echo ^< > test.txt
>
> test.txt contains the right message.
>
> But redirection to pipe seems to be broken.
>
> H:\>echo ^< | more
> The syntax of the command is incorrect.
>
> What's the problem? Is there a solution or workaround?


The command
echo ^< | more
will pipe the string "<" to more.com. I suspect that more.com
is unable to deal with it. The "echo" command works just fine.

Your command is rather strange. What exactly are you trying
to achieve?


 
Reply With Quote
 
=?Utf-8?B?ZmFi?=
Guest
Posts: n/a
 
      19th Jun 2007
I was trying to send a string containing the character > to a program through
pipe. And I think it is not more's fault, as the same problem occurs with all
other programs, not just "more".

I used "more" just as an example, it's not the program I want to use.

"Pegasus" wrote:

>
> "fab" <(E-Mail Removed)> wrote in message
> news:88238844-87BC-4CB1-B6E4-(E-Mail Removed)...
> >I am trying to echo a message and pipe it to another program. The problem
> >is
> > that the message contains spechal characters.
> >
> > The caret ^ can be used as escape for special characters. So, if I type
> >
> > H:\>echo ^<
> >
> > I get the correct output
> >
> > <
> >
> > The same happens if I redirect output to a file
> >
> > H:\>echo ^< > test.txt
> >
> > test.txt contains the right message.
> >
> > But redirection to pipe seems to be broken.
> >
> > H:\>echo ^< | more
> > The syntax of the command is incorrect.
> >
> > What's the problem? Is there a solution or workaround?

>
> The command
> echo ^< | more
> will pipe the string "<" to more.com. I suspect that more.com
> is unable to deal with it. The "echo" command works just fine.
>
> Your command is rather strange. What exactly are you trying
> to achieve?
>
>
>

 
Reply With Quote
 
Pegasus
Guest
Posts: n/a
 
      19th Jun 2007
You can walk around the problem using this syntax:
@echo off
echo ^< > c:\temp.txt
type c:\temp.txt | more

If you're interested in someone digging his teeth into this
one then you should repost your question here:
alt.msdos.batch.nt
They love this type of challenge!


"fab" <(E-Mail Removed)> wrote in message
news:071AB9F6-FE9F-4512-8CFF-(E-Mail Removed)...
>I was trying to send a string containing the character > to a program
>through
> pipe. And I think it is not more's fault, as the same problem occurs with
> all
> other programs, not just "more".
>
> I used "more" just as an example, it's not the program I want to use.
>
> "Pegasus" wrote:
>
>>
>> "fab" <(E-Mail Removed)> wrote in message
>> news:88238844-87BC-4CB1-B6E4-(E-Mail Removed)...
>> >I am trying to echo a message and pipe it to another program. The
>> >problem
>> >is
>> > that the message contains spechal characters.
>> >
>> > The caret ^ can be used as escape for special characters. So, if I type
>> >
>> > H:\>echo ^<
>> >
>> > I get the correct output
>> >
>> > <
>> >
>> > The same happens if I redirect output to a file
>> >
>> > H:\>echo ^< > test.txt
>> >
>> > test.txt contains the right message.
>> >
>> > But redirection to pipe seems to be broken.
>> >
>> > H:\>echo ^< | more
>> > The syntax of the command is incorrect.
>> >
>> > What's the problem? Is there a solution or workaround?

>>
>> The command
>> echo ^< | more
>> will pipe the string "<" to more.com. I suspect that more.com
>> is unable to deal with it. The "echo" command works just fine.
>>
>> Your command is rather strange. What exactly are you trying
>> to achieve?
>>
>>
>>



 
Reply With Quote
 
Poprivet
Guest
Posts: n/a
 
      19th Jun 2007
fab wrote:
> I am trying to echo a message and pipe it to another program. The
> problem is that the message contains spechal characters.
>
> The caret ^ can be used as escape for special characters. So, if I
> type
>
> H:\>echo ^<
>
> I get the correct output
>
> <
>
> The same happens if I redirect output to a file
>
> H:\>echo ^< > test.txt
>
> test.txt contains the right message.
>
> But redirection to pipe seems to be broken.
>
> H:\>echo ^< | more
> The syntax of the command is incorrect.
>
> What's the problem? Is there a solution or workaround?


See alt.msdos.batch.nt - those guys can tell you exactly how. I know you
have to "esc" the character, but not how to at the moment. IF it's
possible, those guys will know how. And, you can quote me on that <g>.

HTH
Pop`


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Echo multiple messages separated by new line thorugh "echo" command Vijay Jain Windows XP General 1 12th Dec 2006 09:11 PM
Echo Command =?Utf-8?B?Smlt?= Microsoft Access VBA Modules 0 29th Sep 2004 11:57 AM
ECHO command Inge Buller Windows XP General 1 23rd Jul 2004 12:45 PM
slow character echo on command prompt or edit.com Ira Microsoft Windows 2000 CMD Promt 1 31st Mar 2004 03:55 PM
No text echo in W2K command prompt Art Armfield Microsoft Windows 2000 CMD Promt 2 9th Oct 2003 04:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:46 PM.