I want to add what I use in shell scripts (but can easily be used in any language) here.The reason is, that some of the solutions here don't work an WoW64, some use things not really meant for that (checking if there is a *(x86) folder) or don't work in cmd scripts.I feel, this is the "proper" way to do it, and should be safe even in future versions of Windows.
The best way is surely just to check whether there are two program files directories, 'Program Files'and 'Program Files (x86)'The advantage of this method is you can do it when the o/s is not running, for instance if the machine has failed to start and you wish to reinstall the operating system
Today, I posted some code on another question and an explanation of how to do this with IsWow64Process2 for Windows 10 version 1511 or later and Windows Server 2016. Additionally, the code determines if the process is 32 or 64 bit and whether the process is running under the WOW64 emulator.
You can use the module from npm called @wider/utils_where-am-i. This runs in any javascript environment on a windows machine and elsewhere such as linux. On a windows machine it delivers an object which has os: 'win32' or os : 'win64' . It can run as legacy plain javascript say in wshell, in classic ASP or nodeJS
7fc3f7cf58