Unacceptable answer in duplicate question, but here is how I do it:
Use GetEnvironmentVariable to search for the variable PROCESSOR_ARCHITEW6432. If it does not exist, you should run 32bit:
bool is64bit = !string.IsNullOrEmpty( Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"));
source share