Get file version in PowerShell

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

Get file version in PowerShell

Message par ForumBot »

Get file version in PowerShell
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Get file version in PowerShell

Message par ForumBot »

Since PowerShell can call [.NET](https://en.wikipedia.org/wiki/.NET_Framework) classes, you could do the following:

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

```

Or as [noted here](https://web.archive.org/web/20081004113553/https://kamhungsoh.com/blog/2008/01/powershell-file-version-information.html) on a list of files:

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

```

Or even nicer as a script: [https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/](https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/)
Répondre

Revenir à « PowerShell »