在 PowerShell 中获取文件版本 [英] Get file version in PowerShell
本文介绍了在 PowerShell 中获取文件版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从 PowerShell 中的 .dll
或 .exe
文件中获取版本信息?
How can you get the version information from a .dll
or .exe
file in PowerShell?
我对文件版本
特别感兴趣,尽管其他版本信息(即Company
、Language
、Product Name
等)也会有帮助.
I am specifically interested in File Version
, though other version information (that is, Company
, Language
, Product Name
, etc.) would be helpful as well.
推荐答案
由于 PowerShell 可以调用 .NET 类,您可以执行以下操作:
Since PowerShell can call .NET classes, you could do the following:
[System.Diagnostics.FileVersionInfo]::GetVersionInfo("somefilepath").FileVersion
或者作为 在文件列表中注明:
get-childitem * -include *.dll,*.exe | foreach-object { "{0}`t{1}" -f $_.Name, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($_).FileVersion }
或者甚至更好的脚本:https://jtruher3.wordpress.com/2006/05/14/powershell-and-file-version-information/
这篇关于在 PowerShell 中获取文件版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文