如何确定我正在安装的应用程序是 32 位还是 64 位? [英] How do I determine whether an application I am installing is 32-bit or 64-bit?

查看:27
本文介绍了如何确定我正在安装的应用程序是 32 位还是 64 位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够预测应用程序的默认安装位置.在 64 位机器上,如果是 32 位应用程序,它会安装在Program Files (x86)"中,如果是 64 位应用程序,它会安装在Program Files"中.

我的目标是使用默认位置安装应用程序并验证安装是否正常.但是为此,我需要知道它将安装在哪里.如果我知道应用程序是为什么架构构建的,我认为它可以满足我的目的.

解决方案

如果你可以使用外部工具,那么

您可以在以下链接中找到更多方法.还有其他 PowerShell 和 VBS 脚本可用于此目的

I want to be able to predict the default install location of an application. On a 64-bit machine, if it is a 32-bit application, it would install in "Program Files (x86)" and if it were a 64-bit application, it would install in "Program Files".

My goal is to install the application with its default location and validate if the install was fine. But for this I need to know where it would be installed. If I know what architecture the application is built for, I think it would serve my purpose.

解决方案

If you can use external tools then GNU file is the most versatile solution. But it might be a bit overkill for this purpose. Other alternatives being Dependency Walker, Sysinternals' Sigcheck, MSVC's dumpbin or corflags... But the one that might surprise a lot of people is 7zip. It has a small file-like utility inside that can be used with l option

C:>7z l "C:Program Files (x86)Windows Photo ViewerImagingDevices.exe" | findstr CPU
CPU = x86

C:>7z l "C:Program FilesWindows Photo ViewerImagingDevices.exe" | findstr CPU
CPU = x64


If you have to check it yourself then read 2 bytes at offset 0x3C in the file. Then add 4 to this value and read 2 bytes at that offset, that'll indicate the architecture. For example in the below example the file contains 0x00E0 at offset 0x3C. At offset 0x00E0 + 4 = 0x00E4 contains 0x8664 which means a 64-bit binary. If it was a 32-bit x86 binary then it will contain 0x014C

There are more ways that you can find in the below links. There are also other PowerShell and VBS scripts available for that purpose

这篇关于如何确定我正在安装的应用程序是 32 位还是 64 位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆