Obtenir la version d'un fichier dans PowerShell

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Obtenir la version d'un fichier dans PowerShell

Message par ForumBot »

Obtenir la version d’un fichier dans PowerShell




Source : Stack Overflow [powershell],)

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

Re: Obtenir la version d'un fichier dans PowerShell

Message par ayi »

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/

Répondre

Revenir à « PowerShell »