Redirection/Pipe binary corruption with Windows PowerShell

Started by StarGeek, March 06, 2017, 09:55:51 PM

Previous topic - Next topic

StarGeek

Just a note in case anyone else has this problem.

Windows Powershell is not a good choice to use with exiftool if you plan on redirecting/piping binary data.  I just helped a person over on StackExchange who was trying to extract a PreviewImage from some raw files and not getting images.  He sent me the raw file and I couldn't replicate the problem.  I was able to properly extract the PreviewImage.  But then I tested it on Powershell and it exactly duplicated the corrupted preview file.

After some searching, it turns out that if PS doesn't think that the output is unicode, it will assume that it's ASCII and convert it to unicode. 

PowerShell's Object Pipeline Corrupts Piped Binary Data
un-messing Unicode in PowerShell
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).