通过注册表、命令行或软件更改 COM 端口? [英] Change COM port via registry, command line or software?

查看:98
本文介绍了通过注册表、命令行或软件更改 COM 端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何更改 Windows 映射到 USB 虚拟 COM 端口的 COM 端口号吗?您可以通过设备管理器"并单击高级"按钮来更改此设置.但如何通过 API、注册表更改或命令行操作来执行此操作?

Does anybody know how to change the COM port number that Windows maps to a USB virtual COM port? You can change this via the Device Manager and clicking on the Advanced button.. but how can you do this via an API, registry change or command line operation?

有什么想法吗?

推荐答案

您可能会发现这个答案很有用:

You might find this answer useful:

我该怎么做在 Windows 中获取 COM 端口的友好名称?

这是关于找到友好名称,但我认为您会发现它会将您指向注册表的正确区域,使用官方"机制来定位正确的密钥.

It's about finding the friendly name, but I think you'll find it points you towards the right area of the registry, using the 'official' mechanism for locating the right key.

但是,如果您更改端口分配,您还应该更新 com 端口数据库 - 请参阅:https://msdn.microsoft.com/en-us/library/ff546481.aspx

However, if you change the port assignment, you should also update the com port database - see: https://msdn.microsoft.com/en-us/library/ff546481.aspx

当我不得不做类似的事情时,我使用链接的 SO 文章中描述的机制找到了正确的设备,然后调用了 SerialDisplayAdvancedSettings((HWND)NULL, hDeviceInfo, &devInfoData);显示高级对话框并让操作系统处理繁重的工作.

When I had to do something similar, I found the right device using the mechanism described in the linked SO article, and then called SerialDisplayAdvancedSettings((HWND)NULL, hDeviceInfo, &devInfoData); to display the advanced dialog and let the OS handle the hard work.

如今,您越来越有可能遇到奇怪的非真实"串行端口(例如 USB 端口),这些端口可能还有其他不兼容的问题,您也需要警惕.

Nowadays you're more and more likely to be encountering odd 'not real' serial ports (e.g. USB ports) which might have other incompatibilities you need to be wary of too.

这篇关于通过注册表、命令行或软件更改 COM 端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆