(view source code of islaptop.kix as plain text)
; Online help requested?If $help
Syntax
EndIf
; Connect to computer's WMI service$objWMIService = GetObject( "winmgmts://./root/cimv2" )
; Display error number and description if applicableIf @ERROR
ShowError()
EndIf
; Get chassis object$colChassis = $objWMIService.ExecQuery( "Select * from Win32_SystemEnclosure", , 16 )
; Display error number and description if applicableIf @ERROR
ShowError()
EndIf
; Following code based on Guy Thomas' CHASSIS script; http://computerperformance.co.uk/; Remove statements if you want to check for more specific; laptop type (see comment lines after each CASE statement)For Each $objChassis in $colChassis
For Each $objItem in $objChassis.ChassisTypes
Select
Case $ObjItem = 8
; Portable$IsLaptop = 1
Case $ObjItem = 9
; Laptop$IsLaptop = 1
Case $ObjItem = 10
; Notebook$IsLaptop = 1
Case $ObjItem = 11
; Hand Held$IsLaptop = 1
Case $ObjItem = 12
; Docking Station$IsLaptop = 1
Case $ObjItem = 14
; Sub Notebook$IsLaptop = 1
Case 1
$IsLaptop = 0
EndSelect
Next
Next
; DoneIf $IsLaptop
"This computer is a laptop"Else
"This computer is NOT a laptop"EndIf
; Return codeQuit $IsLaptop
Function ShowError()
? "Error # @ERROR"
?Syntax
EndFunction
Function Syntax()
? "IsLaptop.kix, Version 1.00"
? "Check if a computer is a laptop"
?? "Usage : KIX32 ISLAPTOP.KIX [ $$help=1 ]"
?? "Returns : Errorlevel 2 after help screen, 1 on laptops, otherwise 0"
?? "Notes : Based on Guy Thomas' CHASSIS.VBS (http://computerperformance.co.uk/)"
? " This script requires Windows 2000 or later and KiXtart 4.00 or later"
?? "Written by Rob van der Woude"
? "http://www.robvanderwoude.com"
? ; Abort with return code 1Quit 2
EndFunction
page last modified: 2025-10-11; loaded in 0.0081 seconds