I am experiencing a problem with ExifTool when trying to use (two) quotation marks within text fields in PowerShell commands.
When I attempt to include spaces within quoted text, it results in an error stating "File not found".
For example:
.\exiftool.exe -Comment='This is a "quoted_mark" and "this is 2nd version" text' *.png
I've try this also:
.\exiftool.exe -Comment='This is a `"quoted_mark`" `"this is 2nd version`" text' *.png
This command fails if there are spaces within the quotation marks. It appears that PowerShell might be misinterpreting the space as a separator even when the text is within quotes.
Has anyone else encountered this issue? Any advice on how to correctly format the command to avoid this error would be greatly appreciated.
Thank you!
Simple answer, use CMD.
PowerShell has different quoting rules than every other command line. I posted on this previously (https://exiftool.org/forum/index.php?msg=80581). I've long since given up on figuring out PS's... idiosyncrasies (the words I actually use are more colorful). If you insist on using PS, then you'll have to find a solution elsewhere, as this is a PowerShell issue, not an exiftool one.
Also, another reason not to use PS is that it corrupts binary data (https://exiftool.org/forum/index.php?msg=41663) when using a pipe | or file redirection.
I'm no fan of PS either, but couldn't resist playing. This works for me in PS.
-Comment='This is a \"quoted_mark\" and \"this is 2nd version\" text'
Great, it's solved. Thanks for the valuable answer! 🎉