Code: Select all
ECHO test> 1.txt
IF EXIST 1.txt (TYPE 1.txt) ELSE (ECHO test)
test
(IF EXIST 1.txt (TYPE 1.txt) ELSE (ECHO test))
test
Code: Select all
(IF EXIST 1.txt (TYPE 1.txt) ELSE (ECHO test)) | 3rd-party-command ...
( was unexpected at this time.
I've tried to escape the inner parentheses, but to no avail.
In the meantime an alternative that does work for me:
Code: Select all
(TYPE 1.txt 2>NUL || ECHO test) | 3rd-party-command ...
Code: Select all
ECHO test | 3rd-party-command ...
ECHO test| 3rd-party-command ...
(ECHO test) | 3rd-party-command ...
(ECHO test)| 3rd-party-command ...
With parentheses around the ECHO-command why does it still put out "test "?