- How to determine if you have a 32-bit or 64-bit CPU
- Windows 8 and 10
- Earlier versions of Windows
- Determine if using 32-bit or 64-bit version of Windows
- Determine if Windows Vista, 7, 8 and 10 is 32-bit or 64-bit
- Determine if Windows XP is 32-bit or 64-bit
- Determine if Windows 2000 and prior is 32-bit or 64-bit
- Apple macOS
- Linux
- Determine if the Linux kernel is 32-bit or 64-bit
- How can I test a Windows DLL file to determine if it is 32 bit or 64 bit? [duplicate]
- 5 Answers 5
- Gory details
- Use ImageHelp to read the headers.
- . or adapt this rough Perl script
- Gizmo’s Freeware
- Login / Register
- Main menu
- How to Find Out if a Program or Executable File is 64-bit or 32-bit
- EXE 64bit Detector
- The really simple way to check if a file is 32-bit or 64-bit
- batch file to check 64bit or 32bit OS
- 22 Answers 22
How to determine if you have a 32-bit or 64-bit CPU
The steps to determine whether your computer has a 32-bit or 64-bit processor (CPU) depend on the type of operating system installed. Below are the steps to determine the processor type for Windows, Mac, and Linux.
Windows 8 and 10
To determine your CPU type in Windows 8 and Windows 10:
- In the Windows search box, type system information and select the System Information icon.
Or, if you do not have a search box (because you have disabled it):
- Open a File Explorer window by pressing Windows key + E .
- On the left, right-click This PC.
- In the context menu, select Properties. The System Properties window opens.
- In the System Properties window, find your System type, which lists your operating system and CPU type.
Earlier versions of Windows
If you are using an earlier version of Windows, follow these steps.
- Open the Start menu >All Programs. Open the Accessories folder, then the System Tools folder. In the System Tools folder, select the System Information option.
On the right side of System Information, look for the System Type option under the Item column. The associated value, in the Value column, will tell you which type of CPU the computer has in it. If the System Type value includes «x86» in it, the CPU is 32-bit. If the System Type value includes «x64» in it, the CPU is 64-bit.
Determine if using 32-bit or 64-bit version of Windows
Microsoft Windows is available in 64-bit and 32-bit. 32-bit processors can only run 32-bit versions of Windows. However, 64-bit processors can run either the 64-bit or 32-bit versions.
To determine if the version of Windows on your computer is 32-bit or 64-bit, choose your version and follow the steps.
Determine if Windows Vista, 7, 8 and 10 is 32-bit or 64-bit
- Press and hold the Windows key and the Pause key.
- In the System window, next to System type, it lists 32-bit Operating System for a 32-bit version of Windows, and 64-bit Operating System if you’re running the 64-bit version. Below is a picture and an example of this window.
Determine if Windows XP is 32-bit or 64-bit
- Press and hold the Windows key and the Pause key, or open the System icon in the Control Panel.
- On the General tab of the System Properties window, if it has the text Windows XP, the computer is running the 32-bit version of Windows XP. If it has the text Windows XP Professional x64 Edition, the computer is running the 64-bit version of Windows XP.
Determine if Windows 2000 and prior is 32-bit or 64-bit
Windows operating systems, from Windows 95 to Windows 2000, are all 32-bit. There are no 64-bit versions of these operating systems.
Apple macOS
On the macOS, click the Apple icon in the menu bar. Select the About This Mac option in the Apple menu. On the About This Mac window, click the More Info option. Open the Hardware section and find the Processor Name attribute. Once listed, perform an Internet search, using that CPU’s processor name as a keyword, to determine if it’s a 32-bit or 64-bit CPU.
Processor | 32-bit or 64-bit |
---|---|
Intel Core Duo or Solo | 32-bit |
Intel Core 2 Duo | 64-bit |
Any Intel Xeon processor | 64-bit |
Intel Core i3 | 64-bit |
Intel Core i5 | 64-bit |
Intel Core i7 | 64-bit |
As shown in the table above, all the most recent Mac computers are 64-bit processors.
Linux
On the Linux operating system, access the command line interface and enter the following command.
Look for «lm» in the command output. If lm is found in the output, then the CPU is 64-bit. If you don’t see lm or see i386, i486, i586, or i686 in the output, then the CPU is 32-bit. Below is an example output of the command above with lm in the information.
Determine if the Linux kernel is 32-bit or 64-bit
Using the uname command, you can determine if your Linux kernel is 32-bit or 64-bit by running the command below.
This command would give you output similar to the example output below.
If you see x86_64 in the output, this indicates it is x86 and that it is 64-bit.
How can I test a Windows DLL file to determine if it is 32 bit or 64 bit? [duplicate]
I’d like to write a test script or program that asserts that all DLL files in a given directory are of a particular build type.
I would use this as a sanity check at the end of a build process on an SDK to make sure that the 64-bit version hasn’t somehow got some 32-bit DLL files in it and vice versa.
Is there an easy way to look at a DLL file and determine its type?
The solution should work on both xp32 and xp64.
5 Answers 5
Gory details
A DLL uses the PE executable format, and it’s not too tricky to read that information out of the file.
See this MSDN article on the PE File Format for an overview. You need to read the MS-DOS header, then read the IMAGE_NT_HEADERS structure. This contains the IMAGE_FILE_HEADER structure which contains the info you need in the Machine member which contains one of the following values
- IMAGE_FILE_MACHINE_I386 (0x014c)
- IMAGE_FILE_MACHINE_IA64 (0x0200)
- IMAGE_FILE_MACHINE_AMD64 (0x8664)
This information should be at a fixed offset in the file, but I’d still recommend traversing the file and checking the signature of the MS-DOS header and the IMAGE_NT_HEADERS to be sure you cope with any future changes.
Use ImageHelp to read the headers.
You can also use the ImageHelp API to do this — load the DLL with LoadImage and you’ll get a LOADED_IMAGE structure which will contain a pointer to an IMAGE_NT_HEADERS structure. Deallocate the LOADED_IMAGE with ImageUnload.
. or adapt this rough Perl script
Here’s rough Perl script which gets the job done. It checks the file has a DOS header, then reads the PE offset from the IMAGE_DOS_HEADER 60 bytes into the file.
It then seeks to the start of the PE part, reads the signature and checks it, and then extracts the value we’re interested in.
Gizmo’s Freeware
Login / Register
Main menu
How to Find Out if a Program or Executable File is 64-bit or 32-bit
Last updated by v.laurie on 25. November 2020 — 12:04
Sometimes you want to know if an executable file is 64-bit or 32-bit before you install or use it but the source where you got the file doesn’t indicate the nature of the file. Or maybe you just want to make sure. Here are two easy ways to check.
EXE 64bit Detector
There are a variety of ways to find out how a file was compiled. Technology professionals can use a hex editor to read the code but the rest of us need something simpler and one way is to use a little utility called “EXE 64bit Detector”. This tool is a simple command line executable. As long as you are familiar with using the command prompt, its use is quick and easy. The developer’s site is at this link. One annoying thing is that the download link redirects you several times to other pages on the developer’s site and you have to be careful not to click on a toolbar download. So be aware. The utility works in all current versions of Windows. I have tried it in Windows 8, 64-bit. It has to be run in a command prompt with administrator privileges.
The use is simply to enter the command:
Exe64bitDetector.exe –f FileYouAreTesting
The switch –f is required and the complete path to the file you are testing must be used. The graphic below shows an example of its use. Note that the status of ASLR, DEP, and SEH are also given.
The problem with this utility is that not everybody wants to fiddle with the command prompt. So here is an even simpler method. It does not require any additional software at all.
The really simple way to check if a file is 32-bit or 64-bit
- Right-click on the executable file you want to check
- Select “Properties”
- Click the tab “Compatibility”
- An example of the dialog box that opens is shown below
- In the section «Compatibility mode» put a check in the box under «Run this program in compatibility mode for:»
- Open the drop-down menu that lists operating systems. If the list begins with Vista, as shown in the graphic, then the file is 64-bit. If the list of operating systems includes Windows XP, then the file is 32-bit.
- Don’t forget to uncheck the box under «Run this program in compatibility mode for:»
Get your own favorite tip published! Know a neat tech tip or trick? Then why not have it published here and receive full credit? Click here to tell us your tip.
This tips section is maintained by Vic Laurie. Vic runs several websites with Windows how-to’s, guides, and tutorials, including a site for learning about Windows and the Internet and another with Windows 7 tips.
Click here for more items like this. Better still, get Tech Tips delivered via your RSS feeder or alternatively, have the RSS feed sent as email direct to your in-box.
batch file to check 64bit or 32bit OS
Can I check to see if current machine is running 64bit OS or 32bit OS inside a batch file?
EDIT:
Found this online and it is good enough to me now:
22 Answers 22
This is the correct way to perform the check as-per Microsoft’s knowledgebase reference ( http://support.microsoft.com/kb/556009 ) that I have re-edited into just a single line of code.
It doesn’t rely on any environment variables or folder names and instead checks directly in the registry.
As shown in a full batch file below it sets an environment variable OS equal to either 32BIT or 64BIT that you can use as desired.
I use either of the following:
or I set the bit variable, which I later use in my script to run the correct setup.
Hope this helps.
Seems to work if you do only these:
I’ve found these script which will do specific stuff depending of OS Architecture (x64 or x86):
Try to find a way without GOTO please.
For people whom work with Unix systems, uname -m will do the trick.
If you are running the script as an administrator, then the script can use the wmic command.
‘ProgramFiles(x86)’ is an environment variable automatically defined by cmd.exe (both 32-bit and 64-bit versions) on Windows 64-bit machines only, so try this:
Will appear on Win32, and
will appear for Win64.
If you are perversely running the 32-bit cmd.exe process then Windows presents two environment variables:
Run the below in the command prompt:
Start -> Run -> Type cmd and enter the command below in the resulting black box:
Here’s my personal favorite, a logical bomb 🙂
With the AND’s ( && ) and OR’s ( || ) this is a IF THEN ELSE Batch Construct.
None of the answers here were working in my case (64 bit processor but 32 bit OS), so here’s the solution which worked for me:
Here’s a nice concise version:
Don’t use the «Program Files (x86)» directory as evidence of anything: naughty software can easily create this directory on a 32-bit machine. Instead use the PROCESSOR_ARCHITECTURE and PROCESSOR_ARCHITEW6432 environment variables.
I usually do the following:
I really do not understand some of the answers given here (sorry for that). The top-voted answer for example does not return the Windows architecture, instead it will give you the processor architecture. While running a 32-bits Windows build on a 64-bits CPU you will get the wrong result (it’s a query on hardware being used).
The safest option is to query the BuildLabEx value from the registry.
Determine x86 (intel) or x86-64 (amd)
Determine x86 (intel), x86-64 (amd) or arm
An alternative option (mentioned before)
The problem with the latter is when you mess up your variables, you are not able to use this method. Checking for the folder’s existence will cause problems too when there are leftovers from a previous install (or some user purposely created the folder).
This is a one-liner that will have %errorlevel% of 0 for 64-bit, 1 for non-64-bit. I can’t vouch for it working on all versions of Windows, but demonstrates one method for determining it. You can add multiple findstr queries if you know all the possibilities to look for.
set | findstr /i processo.*64 > nul 2>&1
Basically, you’re dumping the environment variables, and using a regular expression to search for something that has » processo » + » 64 » somewhere in its line. The piping is just to suppress the matching lines. If I changed it to set | findstr /i processo.*64 on my current rig, this would be the result:
This is a one-liner to see if your processor is a 64-bit AMD
set | findstr /i processo.*amd.*64 > nul 2>&1
You can take these as a starting point and refine them for your requirements. I ended up using this over known environment variable names due to it being more reliable across different major versions of Windows that I was working with.
Many DOS commands in the different versions of Windows are similar but may support different parameters. Plus, newer versions of Windows may support new commands or retire older ones. Thus, if you wish to write a batch file that can run on different types of machines, it may prove beneficial to determine the version of Windows on which the batch file is running. This way the batch file can execute commands appropriate to the operating system.
The following batch file will determine whether or not the machine is running Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, Windows 2000, or Windows NT. It can easily be modified to support other versions of Windows as necessary or to set an environment variable based on the version of Windows detected. Note that for this batch file to correctly discern between newer versions of Windows Server and consumer versions of Windows, it is more convoluted than batch files you may see elsewhere. I have explained the reasoning below.
1) Open a Notepad window.
2) Copy the following text into Notepad (you may want to access this tip’s printed version as some lines wrap):
3) Save the file as %WINDIR%\whichvers.bat
4) Now, from the command prompt, enter:
This will display which version of Windows you are running.
The reasoning for using the SYSTEMINFO command rather than relying on the VER command is because Windows Server 2008 «shares» version numbers with other Windows releases (see Microsoft). Thus relying on a «version number» of 6.0 to detect Windows Vista or 6.1 to detect Windows 7 fails to differentiate a machine from Windows Server 2008 or Windows Server 2008 R2.
The creation of %TEMP%\osname.txt is solely because I could not place the results of systeminfo | find «OS Name» directly into the for /f command — it does not like piped commands. You may find an easier way to handle grabbing the information from SYSTEMINFO — if so, please comment.
The environment variable %vers% has leading spaces. I could remove these with a longer batch file, but in this case it is not necessary.
The batch file detects for SYSTEMINFO as it assumes if it gets beyond the older operating system detections, the running version of Windows is even older and will not have this utility. On Windows 7 64-bit it is still located in the %SystemRoot%\system32 folder — if later versions of Windows become 64-bit only, this batch file may have to be updated.