@ECHO OFF powershell.exe -Command "& {(Get-CimInstance -ClassName Win32_OperatingSystem).Caption}" |Find "Microsoft Windows Server" > Nul IF %ERRORLEVEL% == 0 GOTO WINSERVERS powershell.exe -Command "& {(Get-CimInstance -ClassName Win32_OperatingSystem).Caption}" |Find "Microsoft Windows 10" > Nul IF %ERRORLEVEL% == 0 GOTO WIN10PCS powershell.exe -Command "& {(Get-CimInstance -ClassName Win32_OperatingSystem).Caption}" |Find "Microsoft Windows 11" > Nul IF %ERRORLEVEL% == 0 GOTO WIN11PCS GOTO END :WINSERVERS ECHO This device running Windows Server. GOTO END :WIN10PCS ECHO This device running Windows 10. GOTO END :WIN11PCS ECHO This device running Windows 11. GOTO END :END ECHO END