I'm trying to make a WinPE iso and test if it has booted up on BIOS or UEFI mode. Currently I can test this with the following command:
reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType
This command returns
0x1 if the PC is booted into BIOS mode, or
0x2 if the PC is booted in UEFI mode.
Technet shows a script to show this automatically after WinPE has booted by adding this to startnet.cmd:
wpeutil UpdateBootInfo for /f "tokens=2* delims= " %%A in ('reg query HKLM\System \CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%%B :: Note: delims is a TAB followed by a space. if %Firmware%==0x1 echo The PC is booted in BIOS mode. if %Firmware%==0x2 echo The PC is booted in UEFI mode.
But when I boot up the WinPE, the cmd shows this error:
X:windows\system32>wpeinit UpdateBootInfo X:\windows\system32>for /F "tokens=2* delims= " %A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET Firmware=%B echo was unexpected at this time. X:\windows\system32>if ==0x1 echo The PC is booted in BIOS mode. X:\windows\system32>_
Can anybody help me?
Thank you very much!