Windows cmd: why is the order in which output redirection is indicated?

if you do

ipconfig.exe 1> output.log 2>&1

this will direct all output (both stdout and stderr) to "output.log".

However, if you do this (by changing the order in which you specify the required redirects)

ipconfig.exe 2>&1 1> output.log

this will not have the expected effect of printing both output streams in "output.log", because "stderr" in this case will be printed to the console.

I suspect this is due to the way the cmd commands parse commands that give different values ​​depending on the order in which you specify the redirects.

If so, what are the semantic rules and where are they documented?

, , , , , , .

+4
1

. stdout stderr , , stderr , stdout , stderr . stdout .

.

+4

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


All Articles