Property to determine boot method

How to find out which boot method is enabled such as UEFI or Legacy, through analysis (Relevance needed) and incorporate it to a property.

See similar old post: UEFI / Legacy ( Relevance Need)

I had my doubts about the last method there proposed by @cmbc - checking the “FIRMWARE_TYPE” environment variable. I had never heard of this variable, though it would have been useful to me in the past. Using the ‘SET’ command in my command prompt reflected no FIRMWARE_TYPE variable.

Then, I tried it in Relevance, and … sure enough, it worked.

// we can get the value from environment variable
q: value of variable "FIRMWARE_TYPE" of environment
A: UEFI
T: 1.009 ms
I: singular string

// ? but it is not enumerated among the other environment variables?
q: variables whose (it as string contains "FIRM") of environment
T: 0.941 ms
I: plural environment variable

// and yet, enumerating other variables *does* work...
q: variables whose (it as string contains "PATH") of environment
A: HOMEPATH = \Users\jason.walker
A: PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.RB;.RBW
T: 0.473 ms
I: plural environment variable
1 Like

I think it is because it is not really “environment variable” in the classic sense of it but instead on-the-go function they built into the OS: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfirmwareenvironmentvariableexw#see-also.

2 Likes