1. 程式人生 > >判斷是否UEFI系統,32位還是64位?

判斷是否UEFI系統,32位還是64位?

@echo off
REM Need to be run as Administrator
REM For Windows Vista and above

REM try admin cmd to check access right
bcdedit 2>&1 >NUL
if /%ERRORLEVEL%/ == /1/ goto Need_Priviledge

REM For UEFI OS, there is boot loader winload.efi
REM For Legacy OS, boot loader is winload.exe
bcdedit | find /i "winload.exe" > NUL
if /%ERRORLEVEL%/ == /0/ goto legacy_OS

:UEFI_OS
set a=UEFI
goto next

:Legacy_OS
set a=Legacy
goto next

:next
REM systeminfo | find /i "x64-based PC" >NUL
wmic OS get OSArchitecture | find /i "64-bit" >NUL
if /%ERRORLEVEL%/ == /0/ goto x86

:x64
set b=x64
goto show

:x86
set b=x86
goto show

:show
echo.
echo This is %a% %b% OS!
echo.
set a=
set b=
pause
exit

:Need_Priviledge
echo.
echo Please run as Administrator!
echo.
pause
exit