How do I get file version information from the command line?

Raymond Chen

Raymond

The great thing about Windows file versions is that there are so many to choose from!

For each file, you have

  • Numeric product version
  • Numeric file version
  • String product version
  • String file version

The numeric and string versions generally match, but there is no enforcement. Often the string version incorporates the numeric version but adds some additional information, like 3.1.0.2 (alpha). Sometimes the string version disagrees with the numeric version. This can happen when MUI satellite DLLs enter the picture.

You can use PowerShell to obtain the version information for a file.

PS> (Get-Command C:\Path\To\Thing.dll).FileVersionInfo.FileVersion
3.1.0.2

The version number parts of the File­Version­Info are

Product Field File Field Meaning Example
ProductVersion FileVersion String version 3.1.0.2 (alpha)
ProductMajorPart FileMajorPart First number 3
ProductMinorPart FileMinorPart Second number 1
ProductBuildPart FileBuildPart Third number 0
ProductPrivatePart FilePrivatePart Fourth number 2

Further reading: How to (correctly) check file versions with PowerShell.

0 comments

Comments are closed. Login to edit/delete your existing comments