4
You have the following bat code:
if %PROCESSOR_ARCHITECTURE%==X86 (echo 32 bits) else echo 64 bits
This code takes the architecture of the processor, but I wanted to take the architecture of the operating system. Someone could help me?
4
You have the following bat code:
if %PROCESSOR_ARCHITECTURE%==X86 (echo 32 bits) else echo 64 bits
This code takes the architecture of the processor, but I wanted to take the architecture of the operating system. Someone could help me?
1
According to Microsoft information contained at this link, the correct way to get the system architecture is the batch below:
@echo off
Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegQry% > checkOS.txt
Find /i "x86" < CheckOS.txt > StringCheck.txt
If %ERRORLEVEL% == 0 (
Echo "This is 32 Bit Operating system"
)
ELSE (
Echo "This is 64 Bit Operating System"
)
1
Yes, to check if the system is 32 or 64 bis:
To get with a loop for:
for /f %%a in ('wmic os get osarchitecture ^|find /i "bits"') do @echo/ %%a bits
Or with if exist you still have another way:
if exist "%SYSTEMDRIVE%\Program Files (x86)\" (
echo 64 bits
) else (
echo 32 bits
)
Browser other questions tagged bat
You are not signed in. Login or sign up in order to post.