You are here

How to check if windows system is 32 or 64 bit in batch/cmd file

if "%PROCESSOR_ARCHITECTURE%" == "x86" (
echo "System is 32 bit"
) else (
echo "System is 64 bit"
)

There are some other solutions, too, but this seems to be the most efficient. This way only works, if you are using the 64 bit cmd.exe:
http://stackoverflow.com/questions/1738985/why-processor-architecture-al...

Microsoft has a solution, too, but it required to create a temp-file:
http://support.microsoft.com/kb/556009/en-us

Also interesting is maybe this article:
http://marsbox.com/blog/howtos/batch-file-programfiles-x86-parenthesis-a...

if not "%ProgramFiles(x86)%" == "" (
set ProgRoot=%ProgramFiles(x86)%
)
echo %ProgRoot%

outputs: C:\Program Files (x86