Unexpected CALL function with redirection

I had a problem with the script, so I went to ss64.com , as usual, to find out what jewelry I can find to help me.

While viewing the page the CALL command I came across this line:

Redirection with and | <> also does not work properly.

However, this page and almost anywhere else that I looked at do not explain how this works unexpectedly. I know that I |can do some unexpected things at all , but I do not know others.

What is this unexpected feature? It depends on how you use the CALL command (calling the label vs script)?

+4
source share
1

, :

call :func | more
exit /b

:func
echo line1
echo line2
exit /b

-

setlocal EnableDelayedExpansion
set var=Line2
( echo Line1
echo !var! ) | more

( )
SO: , ?

CALL, ( )

call echo Hello > output.txt

CALL, .
CALL SO: CMD.EXE? ( 6)

set "myCmd=echo 1 & echo 2"
call %%myCmd%%

%% , %myCmd%, , & CALL .

- (- )

set "myCmd=echo Line1"
call (%%myCmd%%)

, , 1.bat

echo echo Hello > 1.bat
set "myCmd=echo Line1 && echo Line2"
call (%%myCmd%%)
echo End

dostips: CALL me,
, CALL - , .

+2

Source: https://habr.com/ru/post/1524526/


All Articles