FLAC and logging
Reply #3 – 2009-12-01 12:30:26
If you want to redirect both stdout & stderr to a file, here's an example from my (complex) "check hashes" bat I recently created:fsum.exe -c -jf -w "%filename%.md5" >"%rootdir%\temp.txt" 2>&1 The reason I had to do this is because the -w switch checks "improperly formated checksum lines" in the hash file and outputs it to stderr (and on the screen normally), rest of the stuff (checksums failed & file errors) go to normal stdout. Using the "2>&1" has one small annoyance (at least in my case): it doesn't show the output rows in same order than when normally executing the command without redirecting. I.e. the stderr output changes place a bit. Ok, this doesn't solve your "log and normal output" question. I researched this topic some time ago and in order to achieve what you want, you need to use a tool, a free one, TEE (part of Coreutils - GNU core utilities ). I was going to use (or still a bit undecided) this in my REACT mod. Here's one of my notes about testing TEE: "It works almost perfectly; when doing BATFILE 2>&1 | tee.exe test.txt , some messages come to the console a bit late, e.g. when the bat-file runs flac.exe, the growing encoding percent indicator does NOT show up in the console until the encoding process is over. The text file though contains all the messages, so it's a small annoyance." (yes, I do write almost all of my notes in English, not in Finnish ) HTH