IsWinPE is a tiny tool to detect if the user is operating under Windows PE ( Preinstallation Environmet ) or Windows. The environment variable ERRORLEVEL is set to 1 if WinPE is detected. Otherwise, ERRORLEVEL is set to 0
test.bat :
IsWinPE.exe
@IF %ERRORLEVEL% == 1 ( @echo Operating in WinPE environment
) ELSE (
@echo Operating in Windows environment
)