Detect Windows Server version 32/64-bit in CLI
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle3
--
Chapters
00:00 Detect Windows Server Version 32/64-Bit In Cli
00:15 Answer 1 Score 9
00:30 Accepted Answer Score 13
01:21 Answer 3 Score 22
01:35 Answer 4 Score 8
01:50 Thank you
--
Full question
https://superuser.com/questions/68452/de...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #64bit #windowsserver2008 #windowsserver2003 #32bit
#avk47
ANSWER 1
Score 22
How about:
echo %PROCESSOR_ARCHITECTURE%
This will return x86 on 32-bit systems and AMD64 (or IA64) on 64-bit systems.
ACCEPTED ANSWER
Score 13
A slightly quicker way would be to check for the existence of the %ProgramFiles(x86)% directory. If it exists then you're running 64-bit, if it doesn't exist then you're running 32-bit.
Quick one-liner:
if exist "%ProgramFiles(x86)%" echo 64-bit
That will output 64-bit
if the directory exists. That would fail, though, if it didn't exist as a variable but it did exist as a directory (as %ProgramFiles(x86)%).
You can also use the find tool to have a more accurate way to determine bitness.
set | find "ProgramFiles(x86)"
or using the systeminfo
command previously
systeminfo | find /I "System type"
(included the /I
to work across XP/2003/2008/etc)
ANSWER 3
Score 9
systeminfo
It will list quite a bit, about 10 fields down there is one called System Type. This will tell you if it's x86 or x64
ANSWER 4
Score 8
systeminfo | find /I "System type"
This is locale dependent, and slow.
echo %PROCESSOR_ARCHITECTURE%
Notice, that it's x86 in 32-bit cmd.exe
.
Correct way:
set Arch=x64
if "%PROCESSOR_ARCHITECTURE%" == "x86" (
if not defined PROCESSOR_ARCHITEW6432 set Arch=x86
)