Page 1 of 1

Removing a token with an obscure trick

Posted: 24 Nov 2011 08:54
by jeb
Hi,

I know this trick for a long time, but I can't found any useful application for it. :wink:

But perhaps have anyone else an use case. :D

Code: Select all

@echo off
echo One two three ^
four

echo One two three^
 four

echo One two<nul three ^
four

echo One two<nul three^
 four


Output wrote:One two three four
One two three four
One two three four
One two four
As you can see in the fourth line the word/token "three" is removed, this is an effect of the redirection and a token just before a multiline caret.
This effect is not related to the ECHO, it works always.

It can strip a single token from a string like here

Code: Select all

set var=one two <nul "this & that"^
three
set var

Output wrote:one two three


But currently I didn't know what problem can be benefit by this :(

jeb

Re: Removing a token with an obscure trick

Posted: 29 Dec 2011 19:17
by phillid
Maybe it could be used for commenting-out things in a weird way? :|