ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: dwlott on May 24, 2022, 11:08:12 AM

Title: Pipe error messages into clipboard or file.
Post by: dwlott on May 24, 2022, 11:08:12 AM
Is there a way to capture error messages?
I can pipe the console output with > or | like this:
e:\exiftool\exiftool -MakerNotes= "e:\mySourceFolder\File1.jpg" -o "e:\myTargetFolder\%f.%e" | Clip
e:\exiftool\exiftool -MakerNotes= "e:\mySourceFolder\File1.jpg" -o "e:\myTargetFolder\%f.%e" > "console.txt"

The clipboard or file contains the result of the operation, but if there are errors, those don't get into the pipe. 
Below; see the line that begins with an error, that is what I would like to capture.  The rest makes it into the pipe.

e:\exiftool -MakerNotes= "e:\mySourceFolder\File1.jpg" -o "e:\myTargetFolder\%f.%e"
Error: 'e:/myTargetFolder/File1.jpg' already exists - e:/mySourceFolder/File1.jpg
    0 image files updated
    1 files weren't updated due to errors




Title: Re: Pipe error messages into clipboard or file.
Post by: StarGeek on May 24, 2022, 11:31:20 AM
Errors go to STDERR. This is part of most command lines on any system. In order to capture them, you can redirect STDERR into a file or into STDOUT

See this article (https://www.rushis.com/windows-command-prompt-redirecting-stdoutstderr/).
Title: Re: Pipe error messages into clipboard or file.
Post by: dwlott on May 25, 2022, 10:48:46 AM
Thank you StarGeek.  I found that " 1> e:\exiftool\out.txt 2>&1" gets both STDOUT and STDERR into a file.  I could not figure out how to get both into the clipboard, but I can use the created file just fine.