C++ 区分由cl.exe(Visual Studio C+;+;)生成的32位和64位PE对象文件

C++ 区分由cl.exe(Visual Studio C+;+;)生成的32位和64位PE对象文件,c++,windows,executable,msys2,cl,C++,Windows,Executable,Msys2,Cl,给定cl.exe中的两个PE对象文件,一个32位和一个64位,我如何在不使用unix实用程序的情况下,最好在命令行(cmd.exe或powershell)上区分另一个 如果我安装了文件实用程序,它几乎可以理解: $ file test*.obj test32.obj: Intel 80386 COFF object file, not stripped, 3 sections, [...] test64.obj: data 文件--版本为5.28,但较新的5.25没有做得更好。msys2不提供

给定
cl.exe
中的两个PE对象文件,一个32位和一个64位,我如何在不使用unix实用程序的情况下,最好在命令行(cmd.exe或powershell)上区分另一个

如果我安装了
文件
实用程序,它几乎可以理解:

$ file test*.obj
test32.obj: Intel 80386 COFF object file, not stripped, 3 sections, [...]
test64.obj: data
文件--
版本为5.28,但较新的5.25没有做得更好。msys2不提供
objdump.exe
,但当复制到Linux时,它可以正确区分这两个文件:

$ objdump -a test64.obj
test64.obj:     file format pe-x86-64
$ objdump -a test32.obj
test32.obj:     file format pe-i386

一些比
文件
更好的东西,可以通过msys2的pacman获得,这可能也很有趣。

最直接的方法是使用微软的工具,传递选项,例如

dumpbin /HEADERS cl.exe | findstr "machine"
这将为64位映像生成以下输出

            8664 machine (x64)
             14C machine (x86)
                   32 bit word machine
对于32位图像,请执行以下操作

            8664 machine (x64)
             14C machine (x86)
                   32 bit word machine

Microsoft工具是
dumpbin
。跨站点复制: