Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion ECHO without terminating CRLF - was "Re: com1 input"
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Phil Robyn  
View profile  
 More options Feb 17 2002, 4:46 pm
Newsgroups: microsoft.public.win2000.cmdprompt.admin
From: Phil Robyn <pro...@uclink.berkzipeley.edu>
Date: Sun, 17 Feb 2002 13:43:46 -0800
Local: Sun, Feb 17 2002 4:43 pm
Subject: Re: ECHO without terminating CRLF - was "Re: com1 input"

Al Dunbar wrote:
> "Clay Calvert" <ccalv...@Wanguru.com> wrote in message
> news:3trs6uon4pej3hci56k1csd86lp9bm0uvo@4ax.com...
> > This is an excellent technique.  I definitely hadn't seen it before.

> Gasp! Al Dunbar finally comes up with something new! Will wonders never
> cease?

> > Thanks

> You're welcome. Enjoy.

> /Al

Great tip, Al!  You can also use it to write the 'pesky' characters to a file
(< > | ^ &) if you use double quotes:

<nul (set /p z="<this>|<is>|<only>|<a>|<TEST>")>out.txt

Phil Robyn
Univ. of California, Berkeley

> > On Fri, 15 Feb 2002 22:05:18 -0700, "Al Dunbar"
> > <LuigiDun...@hotmail.com> wrote:

> > >"john miller" <j...@millertransportation.com> wrote in message
> > >news:43ea01c1b558$aa1d7010$19ef2ecf@tkmsftngxa01...
> > >> I have a device attached to COM1 which sends/recieves
> > >> data. I have been able to send data using this:

> > >> echo "command" > COM1

> > >> How can I recieve the answer or result that the device is
> > >> returning.  I would like for the for the data which is
> > >> being transmitted from the device to go to a file.

> > >In testing my previous reply to the above, I ran across a way to simulate
> an
> > >ECHO without a terminating CRLF sequence using batch-only facilities. No
> > >doubt others are aware of this, however, I have not seen it since I have
> > >been following this newsgroup, so will post it here for the benefit of
> any
> > >others who, like myself, did not know.

> > >The command "echo.hello world" emits the string "hello world" followed by
> a
> > >CRLF sequence. There are at least a couple of situations where this fact
> is
> > >a nuisance:

> > >    - displaying a minimalist progress bar.
> > >    - sending arbitrary character strings to a serial device.
> > >    - writing strings from separate commands that need to appear in the
> same
> > >line in an output file.

> > >The command that does this is:

> > >    <nul (set/p anyvariable=string to emit)

> > >The "<nul" pipes a nul response to the set/p command, which will cause
> the
> > >variable used to remain unchanged. As usual with set/p, the string to the
> > >right of the equal sign is displayed as a prompt with no CRLF.

> > >Here is an example where this is used for a rudimentary progress bar:

> > >    @echo off
> > >    for /l %%A in (1,1,20) do (
> > >        <nul (set/p z=%%A)
> > >        >nul ping 127.0.0.1 -n 2
> > >    )

> > >And here is an example where info is written to a single line in a file
> from
> > >multiple uses of the set/p command:

> > >    <nul (set/p z=hello) >out.txt
> > >    <nul (set/p z= world!) >>out.txt
> > >    dir out.txt

> > >The dir command should indicate the file size as 12 bytes: "hello
> world!".

> > >The strings output need not be literal, and can originate from any source
> > >capable of creating a variable, simply by including a variable reference
> in
> > >the prompt string:

> > >    <nul (set/p z=sec min hours: %time:~6,2% %time:~3,2% %time:~0,2%)

> > >/Al

> > Clay Calvert
> > Replace "W" with "L" in email.

--

u n z i p    m y    a d d r e s s    t o    s e n d    e - m a i l


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.