News:

If this site goes down it is because of the crappy DreamHost web hosting: They will disable your "unlimited traffic" web server if a single bot hammers the site with a moderate load.  If necessary, an alternate ExifTool forum page is available at https://sourceforge.net/p/exiftool/discussion/

Main Menu

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
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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