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

Raymond Chen

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 (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

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

Product Field File Field Meaning Example
ProductVersion FileVersion String version (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.


Discussion is closed.

Feedback usabilla icon