Question about using PowerShell Select-String, exiftool(-k)

前端 未结 2 464
北荒
北荒 2021-01-15 02:43

In a PowerShell script I\'m trying to filter the output of the exiftool(-k).exe command below, using Select-String.

I\'ve tried numerous

2条回答
  •  囚心锁ツ
    2021-01-15 03:05

    The naming is inconvenient. Rename it to exiftool.exe and run it without start-process.

    rename-item 'exiftool(-k).exe' exiftool.exe    
    
    C:\Users\bfbarton\PowerShell\exiftool.exe test-jpg | Select-String GPS 
    

    Or

    $env:path += ';C:\Users\bfbarton\PowerShell'
    exiftool test.jpg | Select-String GPS
    

    The website recommends to 'rename to "exiftool.exe" for command-line use'. https://exiftool.org . Even in unix, it wouldn't work without escaping the parentheses.

    There's also the option of using the call operator. Using tab completion actually does this:

    & '.\exiftool(-k).exe' test.jpg | select-string gps
    

提交回复
热议问题