用 PowerShell 查看 EXE/DLL 的版本信息

排查问题、报 bug 前先确认程序到底是哪个版本,比右键属性更快。

Windows文件PowerShell诊断低风险
运行 `(Get-Item "C:\Path\app.exe").VersionInfo | Format-List`,即可查看文件版本、产品版本和公司名称。

01命令

命令
$ (Get-Item "C:\Program Files\App\app.exe").VersionInfo | Format-List FileVersion, ProductVersion, CompanyName, ProductName

02作用说明

文件“详细信息”选项卡里显示的版本数据,就是文件对象的 VersionInfo 属性,直接在命令行读取即可。报 bug 时说明确切版本号、确认某个 DLL 是否真的被更新、或对比多台机器的版本,都靠它。脚本里需要时也可用 .NET 的 FileVersionInfo::GetVersionInfo(path)。

03风险

风险低风险
使用条件Windows PowerShell; works on exe, dll, and sys files that carry version resources.

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Get-Item — Retrieve an object
    SS64 · technical · 2026-09-17
    依据: Shows accessing an item's VersionInfo property through Get-Item to read executable file metadata.
  • FileVersionInfo.GetVersionInfo
    Microsoft Learn (.NET) · vendor-doc · 2026-09-17
    依据: Documents the FileVersionInfo API underlying the VersionInfo property, with FileVersion and ProductVersion fields.

最后验证: 2026-09-19 · 分类: 文件与文件夹

06相关方案