用 PowerShell 查看 EXE/DLL 的版本信息
排查问题、报 bug 前先确认程序到底是哪个版本,比右键属性更快。
运行 `(Get-Item "C:\Path\app.exe").VersionInfo | Format-List`,即可查看文件版本、产品版本和公司名称。
01命令
命令
$ (Get-Item "C:\Program Files\App\app.exe").VersionInfo | Format-List FileVersion, ProductVersion, CompanyName, ProductName02作用说明
文件“详细信息”选项卡里显示的版本数据,就是文件对象的 VersionInfo 属性,直接在命令行读取即可。报 bug 时说明确切版本号、确认某个 DLL 是否真的被更新、或对比多台机器的版本,都靠它。脚本里需要时也可用 .NET 的 FileVersionInfo::GetVersionInfo(path)。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-Item — Retrieve an object依据: Shows accessing an item's VersionInfo property through Get-Item to read executable file metadata.
- FileVersionInfo.GetVersionInfo依据: Documents the FileVersionInfo API underlying the VersionInfo property, with FileVersion and ProductVersion fields.
最后验证: 2026-09-19 · 分类: 文件与文件夹