delims?

  • Thread starter Thread starter Y
  • Start date Start date
Y

Y

Hi,

How to specify carriage return as delims? Thanks..

for /f "tokens=1-3 delims=?" %%a in (
 
Sorry, this is in a .bat/.cmd file, so the ^T will not work. Use ¶.
(Alt+0182)

Ray at work
 
Ray at said:
Sorry, this is in a .bat/.cmd file, so the ^T will not work. Use ¶.
(Alt+0182)

Can you confirm that you've successfully managed to use a carriage
return as a delimiter in a FOR /F loop?
 
I have. Try pasting this into a .bat file and running it from the command
prompt.

echo a>test.txt
echo b>>test.txt
echo c>>test.txt

for /f "tokens=1-3 delims=¶" %%a in (test.txt) do (net send %computername%
%%a)

Ray at work
 
Ray at said:
I have. Try pasting this into a .bat file and running it from the command
prompt.

echo a>test.txt
echo b>>test.txt
echo c>>test.txt

for /f "tokens=1-3 delims=¶" %%a in (test.txt) do (net send %computername%
%%a)

Try this:-

for /f %%a in (test.txt) do net send %computername% %%a

Notice anything?
 
As far as I can tell, this is a dead end. First of all a
Control-T is created with Alt-20, but that won't work
anyway. I believe the object is to create a line with
anewline character in the displayed message. Isn't it?

The problem being that NET SEND interprets the CR/LF pair
as the end of the statement and therefore truncates the
message string after the first newline intended for output.

The solution I found is to use a linefeed without a
carriage return. However, it's hard to create this in a
batch procedure or most editors. Notepad and Edit
both 'correct' the malformed lines. In fact, even when I
used DEBUG to change the line ends to linefeeds only, it
appears that the command processor corrected the line ends
as it executed the batch file.

About the best I found was to use a WSH script, something
like this ...

with createobject("wscript.shell")
..run "net send %computername% a" & chr(10) _
& "b" & chr(10) & "c", 0, false
end with

Of course the literals "a", "b" and "c" can be replaced
with variables containing the desired text, possibly read
in from a text file, or as command line parameters (if
they're not too long).

Tom Lavedas
===========
-----Original Message-----
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com>
wrote in message
 
As far as I can tell, this is a dead end. First of all a
Control-T is created with Alt-20, but that won't work
anyway. I believe the object is to create a line with
anewline character in the displayed message. Isn't it?

The OP was trying to use the line feed as a delimiter. The Ctrl+T would
work in edit.com, but if you do it in notepad or something, you can use ¶.



The problem being that NET SEND interprets the CR/LF pair
as the end of the statement and therefore truncates the
message string after the first newline intended for output.


I just used net send for the sake of using something. I could have echoed
instead. Either way, my example was wrong. :]






The solution I found is to use a linefeed without a
carriage return. However, it's hard to create this in a
batch procedure or most editors. Notepad and Edit
both 'correct' the malformed lines. In fact, even when I
used DEBUG to change the line ends to linefeeds only, it
appears that the command processor corrected the line ends
as it executed the batch file.

About the best I found was to use a WSH script, something
like this ...

with createobject("wscript.shell")
..run "net send %computername% a" & chr(10) _
& "b" & chr(10) & "c", 0, false
end with



Using just .bat, you can do
net send %computername% a¶b¶c
 
Yes, I figured out I was barking up the wrong tree.

I posted a retraction of sorts and what I believe is a
workaround for the original request.

Tom Lavedas
===========
-----Original Message-----

As far as I can tell, this is a dead end. First of all a
Control-T is created with Alt-20, but that won't work
anyway. I believe the object is to create a line with
anewline character in the displayed message. Isn't it?

The OP was trying to use the line feed as a delimiter. The Ctrl+T would
work in edit.com, but if you do it in notepad or
something, you can use ¶.
 
Back
Top