Home > Blockchain >  How to read the values of the 'details' tab of a file system obect's property sheet w
How to read the values of the 'details' tab of a file system obect's property sheet w

Time:03-15

Using Powershell, I want to create script to read various executable's version numbers and name. The info is listed on the details tab of the file's property sheet:

enter image description here

The basic file system object's properties do not seem to list them (using get-member). Also, have reviewed the following StackOverflow suggestions, that were not immediately helpful:

stackoverflow ref1
Stackoverflow ref2

Is it possible to do this with powershell?

CodePudding user response:

In your case, the .VersionInfo property of the target executable's System.IO.FileInfo instance, as reported by Get-ChildItem or Get-Item, contains the information of interest:

$exeFile = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'
(Get-ChildItem $exeFile).VersionInfo.ProductVersion

To see all available properties:

$exeFile = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe'
(Get-ChildItem $exeFile).VersionInfo | Format-List *

Note that a different approach is required if different kinds of properties are to be extracted from files, such as photo-related metadata from image files - see this post.

  • Related