I can guess the methods, but they are not accurate.
1. Get the computer name “Win10PE” and find the abbreviation “PE” in the name. The name depends on the author of WinPE, which means it can be without the abbreviation "PE".
2. Check that drive X:\ and B:\ exist. These disks may exist in a regular OS and, conversely, not exist in WinPE.
3. Check virtual disks using QueryDosDevice, the presence of "\Device\Ramdisk".
How to determine that the current OS is WinPE?
Re: How to determine that the current OS is WinPE?
From https://stackoverflow.com/questions/631 ... pe-version :
"If you simply need to determine whether you are running WinPE or not, you can check for the presence of the key MiniNT in
HKLM\System\CurrentControlSet\Control or HKLM\System\ControlSet001\Control. If it is present, you are on WinPE 2.x or higher.
For very old versions of Windows/WinPE before 2.0, check the version of %SYSTEMROOT%\SYSTEM32\FACTORY.EXE."
Microsoft's answer -> https://learn.microsoft.com/en-us/windo ... pe-version
"If you simply need to determine whether you are running WinPE or not, you can check for the presence of the key MiniNT in
HKLM\System\CurrentControlSet\Control or HKLM\System\ControlSet001\Control. If it is present, you are on WinPE 2.x or higher.
For very old versions of Windows/WinPE before 2.0, check the version of %SYSTEMROOT%\SYSTEM32\FACTORY.EXE."
Microsoft's answer -> https://learn.microsoft.com/en-us/windo ... pe-version
Re: How to determine that the current OS is WinPE?
WinPE often has wmic omitted. just check the existence of this file.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
Re: How to determine that the current OS is WinPE?
hmm, checking vmic isn't really a good idea, WinPE-WMI is an Optional Components, available in Windows ADK
and thus present in many WinPEs, such as Win10XPE
If you want to test on a file, you can test if winpeshl.exe exist
But it's better to do it like BarryG wrote, check for the presence of the MiniNT registry key:
Batch example IsWinPE.cmd:
and thus present in many WinPEs, such as Win10XPE
If you want to test on a file, you can test if winpeshl.exe exist
But it's better to do it like BarryG wrote, check for the presence of the MiniNT registry key:
Batch example IsWinPE.cmd:
Code: Select all
@Echo Off
Reg.exe Query HKLM\SYSTEM\ControlSet001\Control\MiniNT 1>Nul 2>Nul
If Not ErrorLevel 1 (
Echo Windows PE
Exit /B 1
)
Echo Not a Windows PE
Exit /B 0
