如何查看一个Application是32位的还是64位的?

How to See if Process is 32-bit or 64-bit in Windows 10

OPTION ONE

To See if Process is 32-bit or 64-bit in Processes tab in Task Manager


1 Open Task Manager in more details view.

2 Click/tap on the Processes tab. (see screenshot below)

  • If you see (32-bit) in the process name, then the process is 32-bit.
  • If you don't see (32-bit) in the process name, then the process is 64-bit.
OPTION TWO

To See if Process is 32-bit or 64-bit in Details tab in Task Manager


1 Open Task Manager in more details view.

2 Click/tap on the Details tab, right click on the column header bar, and click/tap on Select columns. (see screenshot below)

How to See if Process is 32-bit or 64-bit in Windows 10-task_manager_process_platform-2.png

How to See if Process is 32-bit or 64-bit in Windows 10-task_manager_process_platform-3.png

使用process explorer查看,找到对应的进程。

注册表的路径是Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\

 

 

使用powershell查看

[reflection.assemblyname]::GetAssemblyName("${pwd}\AssemblyTest.exe") | fl    命令中的pwd是指当前路径

https://stackoverflow.com/questions/270531/how-to-determine-if-a-net-assembly-was-built-for-x86-or-x64

 

PS C:\Users\clu\Downloads\Fusion++.1.2> [reflection.assemblyname]::GetAssemblyName("${pwd}\Fusion++.exe") | fl
MethodInvocationException: Exception calling "GetAssemblyName" with "1" argument(s): "Could not load file or assembly 'C:\Users\clu\Downloads\Fusion++.1.2\Fusion++.exe'. The module was expected to contain an assembly manifest."

 

Look at System.Reflection.AssemblyName.GetAssemblyName(string assemblyFile)

You can examine assembly metadata from the returned AssemblyName instance:

Using PowerShell:

[36] C:\> [reflection.assemblyname]::GetAssemblyName("${pwd}\Microsoft.GLEE.dll") | fl

Name                  : Microsoft.GLEE
Version               : 1.0.0.0
CultureInfo           :
CodeBase              : file:///C:/projects/powershell/BuildAnalyzer/...
EscapedCodeBase       : file:///C:/projects/powershell/BuildAnalyzer/...
ProcessorArchitecture : MSIL
Flags                 : PublicKey
HashAlgorithm         : SHA1
VersionCompatibility  : SameMachine
KeyPair               :
FullName              : Microsoft.GLEE, Version=1.0.0.0, Culture=neut... 

Here, ProcessorArchitecture identifies target platform.

  • Amd64: A 64-bit processor based on the x64 architecture.
  • Arm: An ARM processor.
  • IA64: A 64-bit Intel Itanium processor only.
  • MSIL: Neutral with respect to processor and bits-per-word.
  • X86: A 32-bit Intel processor, either native or in the Windows on Windows environment on a 64-bit platform (WOW64).
  • None: An unknown or unspecified combination of processor and bits-per-word.

I'm using PowerShell in this example to call the method.

 

 

使用visual studio自带的CorFlags

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional>cd "C:\Users\clu\source\repos\Edenred\Test\AssemblyTest\bin\Debug"

C:\Users\clu\source\repos\Edenred\Test\AssemblyTest\bin\Debug>corflags AssemblyTest.exe
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.6.1055.0
Copyright (c) Microsoft Corporation. All rights reserved.

Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 0x20003
ILONLY : 1
32BITREQ : 0
32BITPREF : 1
Signed : 0

 

https://stackoverflow.com/questions/18608785/how-to-interpret-the-corflags-flags

Microsoft .NET 4.5 introduced a new option, Any CPU 32-bit Preferred. In the new version of CorFlags.exe, the 32BIT flag no longer exists, instead, two new flags were added, 32BITREQ and 32BITPREF.

Somewhere based on the below explanation, we can interpret new CorFlags as follows.

CPU Architecture           PE      32BITREQ   32BITPREF
------------------------   -----   --------   ---------
x86 (32-bit)               PE32           1           0
x64 (64-bit)               PE32+          0           0
Any CPU                    PE32           0           0
Any CPU 32-Bit Preferred   PE32           0           1

 

C:\Users\clu\Downloads\Fusion++.1.2>corflags "Fusion++.exe"
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.8.3928.0
Copyright (c) Microsoft Corporation. All rights reserved.

corflags : error CF008 : The specified file does not have a valid managed header

 

C:\Users\clu\Downloads\Fusion++.1.1>corflags "Fusion++.exe"
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.8.3928.0
Copyright (c) Microsoft Corporation. All rights reserved.

Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 0x20003
ILONLY : 1
32BITREQ : 0
32BITPREF : 1
Signed : 0

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(821)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2015-11-26 cmd修改系统时间
2014-11-26 Axis.Labels.CustomSize
2014-11-26 使用 Async 和 Await 的异步编程
点击右上角即可分享
微信分享提示