DLLやEXEファイルが32bitなのか64bitなのか調べる方法です。今回はVisual Studioがインストールされている環境での方法です。
開発者コンソールを開きます。
スタートメニューのVisual Studioのフォルダにある Developer Command Prompt for VS 2022 などのことです。
cd コマンドで対象のディレクトリに移動し、下記コマンドを実行します。例として test.exe を調べる場合です。
[bat]
dumpbin /headers test.exe
[/bat]
実行すると、下記のように出力されました。
Dump of file test.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
6964B724 time date stamp Mon Jan 12 17:56:04 2026
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
102 characteristics
Executable
32 bit word machine
...
注目すべきは、下記です。x86とあり、32 bitとあります。32bitとなります。
...
14C machine (x86)
...
32 bit word machine
...
64bitを確認してみます。
Dump of file test.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
8664 machine (x64)
2 number of sections
6964B716 time date stamp Mon Jan 12 17:55:50 2026
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
22 characteristics
Executable
Application can handle large (>2GB) addresses
...
こちらも注目すべきは、下記です。x64となっているので、64bitです。
...
8664 machine (x64)
...
Application can handle large (>2GB) addresses
...
それとAnyCPUもみてみます。
Dump of file test.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
6964B729 time date stamp Mon Jan 12 17:56:09 2026
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
22 characteristics
Executable
Application can handle large (>2GB) addresses
...
注目すべきは、下記です。
x86となっていて32bitかとも思えますが、32bitのときのように 32 bit word machine がなく、
64bitと同様になっています。この場合はAnyCPUとなります。
...
14C machine (x86)
...
Application can handle large (>2GB) addresses
...
