Powershell Windows10 attempts to read exiftool report

Started by elhiero, December 06, 2024, 10:33:09 AM

Previous topic - Next topic

elhiero

Hi all
Someone gave me a powershell script that contains this :
& $ExifToolName -m -F -q -q -r -ext jpg -p $ExifToolArgs "$FolderPath" >>$TempFileIt works fine.
I would like to remove -q -q and display the exiftool reports on the console.
But powershell systematically tries to execute exiftool responses (x directories scanned) as commands.
I've tried many redirection syntaxes, but none of them allow me to show the exiftool report without it causing shell errors. (even if i can hide errors, but they still occur)

Unsuccesful tries :
   
& $ExifToolName -m -F -r -ext jpg -p $ExifToolArgs "$FolderPath" 1>> $TempFile 2>$Host | ForEach-Object {Write-Host $_ -ForegroundColor Yellow }
& $ExifToolName -m -F -r -ext jpg -p $ExifToolArgs "$FolderPath" 1>> $TempFile |  Out-Host
$null = & $ExifToolName -m -F -r -ext jpg -p $ExifToolArgs "$FolderPath" 1>> $TempFile 2>&1 | ForEach-Object {    [Console]::WriteLine($_) }
& $ExifToolName -m -F -r -ext jpg -p $ExifToolArgs "$FolderPath" 1>> $TempFile | ForEach-Object { Write-Host "`"$_`"" }
& $ExifToolName -m -F -r -ext jpg -p $ExifToolArgs "$FolderPath" 1>> $TempFile 2>> $BaseFolder\out2.txt

Is there a way to retrieve exiftool reports in another way?
Thanks

StarGeek

You might look at these options
-w (-TextOut) option
-W (-TagOut) option
-efile option

The first two write output to a file on a per file/per tag basis (respectively). The last lists filenames that give errors, though not the errors themselves.

Beyond that, you are probably better off looking for a forum that deals with PowerShell, such as /r/PowerShell on Reddit. PS has too many idiosyncrasies compare to every other command line and I no longer have the patience to try and figure them out.
"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