批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[原创代码] PowerShell判断电脑是台式机还是笔记本

在别的论坛看到有人问这个问题,我试着写了一下。
  1. $objSysEnc = gwmi Win32_SystemEnclosure
  2. switch ($objSysEnc.ChassisTypes) {
  3.     1  {"Other"; break}
  4.     2  {"Unknown"; break}
  5.     3  {"Desktop"; break}
  6.     4  {"Low Profile Desktop"; break}
  7.     5  {"Pizza Box"; break}
  8.     6  {"Mini Tower"; break}
  9.     7  {"Tower"; break}
  10.     8  {"Portable"; break}
  11.     9  {"Laptop"; break}
  12.     10 {"Notebook"; break}
  13.     11 {"Hand Held"; break}
  14.     12 {"Docking Station"; break}
  15.     13 {"All in One"; break}
  16.     14 {"Sub Notebook"; break}
  17.     15 {"Space-Saving"; break}
  18.     16 {"Lunch Box"; break}
  19.     17 {"Main System Chassis"; break}
  20.     18 {"Expansion Chassis"; break}
  21.     19 {"SubChassis"; break}
  22.     20 {"Bus Expansion Chassis"; break}
  23.     21 {"Peripheral Chassis"; break}
  24.     22 {"Storage Chassis"; break}
  25.     23 {"Rack Mount Chassis"; break}
  26.     24 {"Sealed-Case PC"; break}
  27.     default {"unknown"}
  28. }
复制代码

返回列表