在PowerShell中获取文件版本 [英] Get file version in PowerShell
本文介绍了在PowerShell中获取文件版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从PowerShell中的 .dll
或 .exe
文件获取版本信息?
我对文件版本
特别感兴趣,虽然其他版本信息(即公司
,语言
,产品名称
等)也将有所帮助。
解决方案
由于PowerShell可以调用 .NET 类,您可以执行以下操作:
[System.Diagnostics.FileVersionInfo] :: GetVersionInfo somefilepath)。FileVersion
或者作为在此记录在文件列表中:
get-childitem * -include * .dll,*。exe | foreach-object {{0}`t {1}-f $ _。Name,[System.Diagnostics.FileVersionInfo] :: GetVersionInfo($ _)。FileVersion}
/ pre>
甚至更好的脚本: http://jtruher.spaces.live.com/blog/cns!7143DA6E51A2628D!125.entry
How can you get the version information from a
.dll
or.exe
file in PowerShell?I am specifically interested in
File Version
, though other version information (that is,Company
,Language
,Product Name
, etc.) would be helpful as well.解决方案Since PowerShell can call .NET classes, you could do the following:
[System.Diagnostics.FileVersionInfo]::GetVersionInfo("somefilepath").FileVersion
Or as noted here 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: http://jtruher.spaces.live.com/blog/cns!7143DA6E51A2628D!125.entry
这篇关于在PowerShell中获取文件版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文