Reputation: 39
I am trying to write a script that will install one of 6 different .MSI
files depending on details of the system. I don't know how to tell the difference between a 32-bit and a 64-bit Windows installation, so that I can install the 64-bit .MSI
on 64-bit systems and the 32-bit .MSI
on 32-bit systems. The script is in Python, if that matters.
Upvotes: 1
Views: 2562
Reputation: 744
The following registry entry will show you whether the system is 32bit or 64bit,
Key Path: HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0
Value Name: Platform ID
Value Type: REG_DWORD
For 32bit,
Value Data (in Hex.): 1
For 64bit,
Value Data (in Hex.): 2
Upvotes: 0
Reputation: 11013
You can also create an MSI or EXE wrapper that will install the package one by one. The tutorial I linked explains how to do this very easy with Advanced Installer, not scripting is required as you have GUI options to configure each installer, so it is much easy to maintain.
Advanced Installer allows you to select from a tree on which OS you want to run each package, so you can specify to run only on x64 or x86 machines, or on just a particular set of x64 or x86 machines.
You do need however a Professional license to the tool, but you can try it for 30 days, to see if it saves you enough time to make it worth the migration, as it should do.
Upvotes: 1
Reputation: 12782
Use this function:
import platform
platform.architecture()
# ('64bit', 'ELF')
or
import os
is64 = os.environ.get("PROCESSOR_ARCHITEW6432") == 'AMD64' or \
os.environ["PROCESSOR_ARCHITECTURE"] != 'x86'
Upvotes: 1