ExifTool Forum

ExifTool => Developers => Topic started by: marcosBal on November 02, 2022, 12:36:18 PM

Title: Powershell: output all data to xml file with greater-than sign (>)
Post by: marcosBal on November 02, 2022, 12:36:18 PM
In Powershell, using

start-process exiftool.exe -ArgumentList "-ext WAV -X -k $directory > test.xml"
displays the results onscreen and gives me an error for the output file:

Error: File not found - test.xml
Is the problem that exiftool is not seeing the "greater than" sign, i.e. ">"? It looks like it is looking for "test.xml" instead of writing to it.

Thank you!!
Title: Re: Powershell: output all data to xml file with greater-than sign (>)
Post by: marcosBal on November 02, 2022, 02:00:09 PM
Never really figured it out, but I used powershell's redirect  (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-7.2)functions to create it within PS. Thanks!
Title: Re: Powershell: output all data to xml file with greater-than sign (>)
Post by: StarGeek on November 02, 2022, 02:14:42 PM
The redirection of the greater/less than symbols is a property of the shell.  I'm guessing that by including it as part of "ArgumentList" means that PS is not seeing it.

Maybe try
start-process exiftool.exe -ArgumentList "-ext WAV -X -k $directory" >test.xml

No, that doesn't do it either.  It opens up a separate shell window. text.xml was created using this, but it was an empty file, probably because all of the exiftool output went to the opened shell window.

Either way, this is a PowerShell problem, not an exiftool one.