Issue with Quotation Marks in PowerShell Using ExifTool

Started by balkisanton, October 14, 2024, 11:08:59 PM

Previous topic - Next topic

balkisanton

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!

StarGeek

#1
Simple answer, use CMD.

PowerShell has different quoting rules than every other command line. I posted on this previously. 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 when using a pipe | or file redirection.
"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

FrankB

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'

balkisanton

Great, it's solved. Thanks for the valuable answer! 🎉