31. March 2022 · Categories: .NET

I recently wanted a fast way on the command line to find all available COM ports, and after some searching I constructed the following:

This code searches for all active port devices, which nowadays should only be COM Ports, then sorts them numerically by port number, and finally displays them together with a description and the manufacturer (of the driver). The only tricky part is that the COM port number is not available directly, but must be extracted from the Name property.

My thanks to this overview by Mathew J Bray, which also includes different approaches.