How to find COM port of connected IoT device on Windows

When you need to talk to an IoT device over RS232 connected to the computer via USB cable, the first thing that you need to know is the name of the port. Windows assigns port numbers like COM3, COM7, COM21 to connected devices. How to find the number?
The quick way is to type the following command:

The quick way is to type following command:

The output:

For older versions of Windows you can use:

The output:

You can find all these hints also on SuperUser.

But what to do when the device is connected and the list of COM ports is empty?

The most common reason is that Windows is missing one of the following drivers:

Steps to resolve the problem:

The system should pick the installed driver and assign it to the device.

You can use also idf-env tool to install the drivers by following PowerShell commands:


Footnote: following PowerShell command might NOT list all connected IoT COM devices, but you can find it on many forums on the internet. Often it displays just COM3 and COM4 which are not associated with IoT device.