- Aug
- 2,082
- 85
I have tried this on my Windows Vista Business Desktop, and my Windows XP Notebook, and the results returned were accurate.
Joe
Code:
::-------------------------------------------------------------------+
:: CHASSISTYPE.BTM |
:: TCC 15.01.51 |
:: Windows Vista |
:: 2013/06/28 - Joe Caverly |
::-------------------------------------------------------------------+
@setlocal
@echo off
:: On my system, wmiquery /a root\cimv2 "select * from Win32_SystemEnclosure" returns;
::
:: Caption = System Enclosure
:: ChassisTypes = {6}
:: CreationClassName = Win32_SystemEnclosure
:: Description = System Enclosure
:: LockPresent = False
:: Manufacturer = Dell Inc.
:: Name = System Enclosure
:: SerialNumber = BXFGHK2
:: SMBIOSAssetTag =
:: Tag = System Enclosure 0
:: Version =
::
:: I require the ChassisTypes value, so;
::
set ChassisType=%@execstr[1,wmiquery /a root\cimv2 "select * from Win32_SystemEnclosure"]
set ChassisType=%@strip[{},%ChassisType]
set ChassisType=%@word[2,%ChassisType]
::
:: According to http://msdn.microsoft.com/en-us/library/windows/desktop/aa394474%28v=vs.85%29.aspx,
:: there are several ChassisTypes. Let's see what mine means;
::
switch %ChassisType
case 1
echo Other
case 2
echo Unknown
case 3
echo Desktop
case 4
echo Low Profile Desktop
case 5
echo Pizza Box
case 6
echo Mini Tower
case 7
echo Tower
case 8
echo Portable
case 9
echo Laptop
case 10
echo Notebook
case 11
echo Hand Held
case 12
echo Docking Station
case 13
echo All in One
case 14
echo Sub Notebook
case 15
echo Space-Saving
case 16
echo Lunch Box
case 17
echo Main System Chassis
case 18
echo Expansion Chassis
case 19
echo SubChassis
case 20
echo Bus Expansion Chassis
case 21
echo Peripheral Chassis
case 22
echo Storage Chassis
case 23
echo Rack Mount Chassis
case 24
echo Sealed-Case PC
endswitch
::
:: I have a Chassis Type of 6, which is a Mini Tower
::
endlocal
Joe