powershell - 如何使用 Powershell 获取 exe 应用程序详细信息
问题描述
我是 Powershell 新手,正在尝试获取 Outlook 文件版本详细信息。
get-itemproperty 'C:\program File (x86)\Microsoft Office\office15\outlook.exe' | 格式列表
这是我使用的命令,但会弹出找不到路径错误。
outlook.exe 路径:C:\program File (x86)\Microsoft Office\office15\outlook.exe
我需要的值 文件版本和产品名称值是我想要的
解决方案
Outlook的版本是16,所以路径不一样...但是,下面应该为您动态找到安装位置,因此无关紧要。
#Set the Reg Key to find
$key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE\'
#Get the Reg Key Property
$outlookExePath = (Get-ItemProperty $key).'(default)'
#Use the Reg Key Property to get the FileInfo
$OutlookExe = get-item $outlookExePath
#Output the File Info Properties as required
$OutlookExe.VersionInfo.ProductVersion
$OutlookExe.VersionInfo.ProductName
#Or output selected properties together
$OutlookExe.VersionInfo|Select-Object -Property ProductName,ProductVersion
推荐阅读
- node.js - 为什么 Docker Hub 上的节点映像没有列出 11.x 版本的映像?
- windows - pip 安装错误,freetype 和 libpng 丢失(Windows)
- opendaylight - 哪些版本的 ODL 支持 l2switch?
- r - 计算R中特定年份的美国假期日期
- docker - Docker.service 无法启动,在 Raspbian 上出现错误“无法挂载覆盖:没有这样的设备”
- javascript - 在不刷新页面的情况下使用 json 数据填充表单中的选择元素选项
- arrays - 根据条件创建单独的数组元素
- r - 在 R 中生成 DNA 密码子组合
- c# - 将 Fody Costura 与 Entity Framework Core 迁移一起使用
- javascript - 两个数字之间的百分比差等于 NaN - JavaScript