找回密码
 加入
搜索
查看: 1786|回复: 1

[网络通信] 怎样获取usb转串口设备的,端口号?

  [复制链接]
发表于 2018-4-3 10:32:08 | 显示全部楼层 |阅读模式
javascript:; 这个硬件是usb口的, 转成串口虚拟的端口号,怎么取得这个端口号?javascript:;
用工具能获得端口号,我想用wmi获取 Win32_SerialPort  这个只能得到 通讯端口。

怎么能得到这个com3?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2018-4-3 11:26:53 | 显示全部楼层
弄出来了,用了这个参数Win32_PNPEntity 所有设备都列出来了 再筛选一下
$objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colBios = $objWMIService.ExecQuery("Select * from  Win32_PNPEntity")
For $object in $colBios
  $bios = StringMid($object.Caption,1)
   $t=StringInStr ( $bios,"USB Serial Port " )
  ;MsgBox(0,"",$t)
   If $t>0 then
  $p=StringRegExpReplace ( $bios, '(\D)', "" )
                MsgBox(0,"",$p)
                                endif
                        Next
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 18:32 , Processed in 0.073358 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表