In linux I can type in echo "hello" >& text.output
and get text output in a file.
How can I get this kind of output in Windows 8?
Is there a way to tell error from output?
My motivation is trying to log the output of tracert
and investigate difference between Windows 8 and Windows 7.
Best Answer
The same way as in Linux:
Errors usually printed to
stderr
stream (it is #2). You can capturestderr
stream:If the file
1.txt
does not exist,text.output
will containCould not find 1.txt
.You can redirect
stdout
tostderr
:Or
stderr
tostdout
:P.S. I'm not sure your command would work in Linux. Anyway
echo "hello" >& text.output
generates a syntax error:>& was unexpected at this time.