Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python MaxOs versionInfo上的PowerShell为空_Python_Macos_Powershell_Winapi_Versioninfo - Fatal编程技术网

Python MaxOs versionInfo上的PowerShell为空

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

我需要在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>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选项的地方:),但结果是空字符串:/