| 
 | 
微软官方部署脚本中也有一段检测BIOS或UEFI的代码:https://go.microsoft.com/fwlink/?linkid=872894 
其中APPLYIMAGE.BAT中有一段可以值得参考: 
@echo Checking to see if the PC is booted in BIOS or UEFI mode. 
wpeutil UpdateBootInfo 
for /f "tokens=2* delims=         " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%%B 
@echo            Note: delims is a TAB followed by a space. 
@if x%Firmware%==x echo ERROR: Can't figure out which firmware we're on. 
@if x%Firmware%==x echo        Common fix: In the command above: 
@if x%Firmware%==x echo             for /f "tokens=2* delims=         " 
@if x%Firmware%==x echo        ...replace the spaces with a TAB character followed by a space. 
@if x%Firmware%==x goto END 
@if %Firmware%==0x1 echo The PC is booted in BIOS mode.  
@if %Firmware%==0x2 echo The PC is booted in UEFI mode.  
 |   
 
 
 
 |