如何通过命令行检查计算机形式(台式机、笔记本电脑还是一体机)?

如何通过命令行检查计算机形式(台式机、笔记本电脑还是一体机)?

出于非常特殊的原因,我需要使用命令提示符、powershell 或 vbs(Windows 7/8 系统)中的命令远程检查计算机的外形尺寸(台式机、笔记本电脑或一体机)。

有什么办法可以做这样的事吗?

提前致谢。

答案1

将其保存为 info.vbs
从命令提示符转到脚本位置并输入 info.vbs,然后按 Enter

 strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colChassis = objWMIService.ExecQuery _
        ("Select * from Win32_SystemEnclosure")
    For Each objChassis in colChassis
        For  Each strChassisType in objChassis.ChassisTypes
            Select Case strChassisType
                Case 1
                    Wscript.Echo "Other"
                Case 2
                    Wscript.Echo "Unknown"
                Case 3
                    Wscript.Echo "Desktop"
                Case 4
                    Wscript.Echo "Low Profile Desktop"
                Case 5
                    Wscript.Echo "Pizza Box"
                Case 6
                    Wscript.Echo "Mini Tower"
                Case 7
                    Wscript.Echo "Tower"
                Case 8
                    Wscript.Echo "Portable"
                Case 9
                    Wscript.Echo "Laptop"
                Case 10
                    Wscript.Echo "Notebook"
                Case 11
                    Wscript.Echo "Handheld"
                Case 12
                    Wscript.Echo "Docking Station"
                Case 13
                    Wscript.Echo "All-in-One"
                Case 14
                    Wscript.Echo "Sub-Notebook"
                Case 15
                    Wscript.Echo "Space Saving"
                Case 16
                    Wscript.Echo "Lunch Box"
                Case 17

相关内容