How save psql `ERROR` output to the same file as the DDL commands?
I want help with how write the command line so I can save the output of the restore to a file.txt. So the create/insert/alter on the backup aren't relevant. And the image is just as reference, I also include the message as text just in case. 


If you're asking how do you put the error to the "result file" too, you need to redirect STDERR as well as STDOUT or direct STDERR to STDOUT with 2&gt;&amp;1

psql.exe -U  sde sde &lt; c:\backup\sde_04_06_2018.backup &gt; c:\backup\result.txt 2&gt;&amp;1


Internally you have three "standard" streams: input, output, and error.


input you're directing that to c:\backup\sde_04_06_2018.backup
output you're directing output to c:\backup\result.txt
You need to also redirect error.