batch file - Bat redirecting stderr to stdout has weird behaviour -


I have a bat script that redirects the stderr of a process to stdout at one point, and then it's a file Writes in I used to do it like this:

  process.exe 2 & gt; And 1> File.txt  

However, this does not redirect the stderr file (for reasons I do not understand). When I modified this line:

  process.exe & gt; File.txt 2 & gt; & Amp; 1  

The whole thing worked, are not these two equal?

The first example basically does:

  stderr = stdout; Stdout = "file.txt";  

Therefore, your second example is indicating stderr still on the original stdout :

 < Code> stdout = "file.txt"; Stderr = stdout;  

Then, both stderr and stdout now reference file.txt . It's annoyingly subtle.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -