Search found 31 matches

by Queue
16 Feb 2013 15:10
Forum: DOS Batch Forum
Topic: Why does piping cause delayed expansion?
Replies: 4
Views: 1433

Why does piping cause delayed expansion?

A simple example:

Code: Select all

set A=B
echo %%A%%
echo|echo %%A%%
echo|echo %%%%A%%%%

outputs:

Code: Select all

%A%
B
%B%

(echo| could be any command that doesn't make cmd.exe abort or output to stderr, like cd;.|, type nul|, etc.)

The third output line confuses me; why doesn't it output %A%?

Queue