Obtenir la version d'un fichier dans PowerShell

Obtenir la version d’un fichier dans PowerShell


Source : Stack Overflow [powershell],)

Puisque PowerShell peut appeler des classes .NET, vous pouvez faire ce qui suit :

[System.Diagnostics.FileVersionInfo]::GetVersionInfo("somefilepath").FileVersion

Ou comme indique ici sur une liste de fichiers :

get-childitem * -include *.dll,*.exe | foreach-object { "{0}`t{1}" -f $_.Name, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }

Ou encore plus elegant sous forme de script : https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/