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:
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:
'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:
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 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).
I usually do the following:
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:
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.