Python MaxOs versionInfo上的PowerShell为空
我需要在MacOS上运行Python脚本,获取windows可执行文件的versionInfo。由于Winapi在MacOS上不可用,我发现这样做的方法是通过powershell命令。按说明通过brew安装。普华永道医院正紧随其后 在MacOS上对exe使用Get-Item或Get-ItemProperty会返回一个值,但ProductionVersion和FileVersion为空:Python MaxOs versionInfo上的PowerShell为空,python,macos,powershell,winapi,versioninfo,Python,Macos,Powershell,Winapi,Versioninfo,我需要在MacOS上运行Python脚本,获取windows可执行文件的versionInfo。由于Winapi在MacOS上不可用,我发现这样做的方法是通过powershell命令。按说明通过brew安装。普华永道医院正紧随其后 在MacOS上对exe使用Get-Item或Get-ItemProperty会返回一个值,但ProductionVersion和FileVersion为空: PS /Users/test>$m = Get-Item /Users/test/test.exe
PS /Users/test>$m = Get-Item /Users/test/test.exe
PS /Users/test>echo $m
Directory: /Users/test
Mode LastWriteTime Length Name
---- ------------- ------ ----
----- 04/29/2021 14:14 1045616 test.exe
PS /Users/test> $m.VersionInfo
ProductVersion FileVersion FileName
-------------- ----------- --------
/Users/test/test.exe
在Windows上对同一文件运行同一命令会返回这两个值
我做错了什么?在MacOS上使用winapi处理win exe是否有其他选择?因此,我认为MacOS无法获得Windows exe版本。这里的答案是:谢谢@GrzegorzOchlik,这正是我发现使用Powershell选项的地方:),但结果是空字符串:/