How can I get the properties of an Image file in windows using the command line?
You can do this using PowerShell.
Commonly filled out metadata for image files contains the camera, the F-stop, resolution, and other useful information about the photo. This can be extremely useful for anyone who takes photos. The image metadata is easily found from the File tab for the photo by clicking Properties, then Details.
To use Windows PowerShell to examine this type of metadata means using the Shell.Application COM object, connecting to a file, and then walking through the metadata property bag. This technique is a bit cumbersome. Luckily, I can use the same function I wrote yesterday to accomplish this task.
Note the complete Get File Metadata function is available on the Script Center Repository.
Make sure to store results
Because it is possible that the script needs to iterate through
thousands of photos, and for each photo it needs to search several
hundred metadata attributes, the script will take some time to run.
The best thing to do is to store the results in a variable. This will
allow sorting and post collection processing of the data following the
Get-FileMetaDataReturnObject.ps1 script contains a single
function. The function is the Get-
FileMetadata function. I load the
function in the Windows PowerShell ISE, and run it to copy the
function into memory. After I have done that, I call the function and
pass it an array of folder paths. I get the array of folder paths by
Get-ChildItem cmdlet. Here is the command that performs a
recursive lookup of a folder named pics and pulls out the directory
paths in that folder. This is a single line command that has wrapped.
$picMetadata = Get-FileMetaData -folder (Get-childitem E:\pics -Recurse -Directory).FullName
Write it to a file
Now that I know that the command produces the output I desire, I pipe
the results to the
Export-CSV cmdlet as shown here (this is a
Select 'camera model', dimensions, f-stop, 'flash mode', 'iso speed', 'exposure time', 'focal length', size, path |
Export-CSV -Path c:\fso\photoMetadata.csv -NoTypeInformation
Source Use PowerShell to Find Metadata from Photograph Files
Read the above source link to see what other metadata is avaialable.
[\\]backslashes instead of one:
wmic datafile where Name="C:\\[...]\\IMG_5443.JPG" get Name,FileType