Windows Running

@echo off
:: The MEM /M command tells if a program is running and
:: what memory it is using. Based on my observations, WIN
:: runs (and doesn’t stop) after Windows starts. But VMM32,
:: the virtual memory manager, only runs while the Windows
:: GUI is active. Using these observations, a DOS batch file
:: can tell what kind of a world it is running in.
::
mem /m win | find “K”
if errorlevel 1 goto NEVER
mem /m vmm32 | find “K”
if errorlevel 1 goto DOSMODE
goto DOSWIN
:NEVER
cls
echo Windows has never run. Machine was booted to DOS only.
goto DONE
:D OSWIN
cls
echo Windows is currently running and DOS is running in a window.
goto DONE
:D OSMODE
cls
echo Windows has run, but the computer was rebooted into DOS mode.
goto DONE
:D ONE