COM Port Numbers

The problem:

My computer assigns a new COM port number every time I plug in a USB to COM Port device such as a Bluetooth adapter or serial port adapter. The old port numbers are not reused. The port numbers keep getting higher and higher, and finally they are higher than my software supports, making the device useless.

What’s going on:

Let’s use a USB Bluetooth dongle as an example of a USB to COM adapter. When a USB device is plugged in, Windows automatically installs the driver and dedicates two COM ports, an incoming and an outgoing port, to this device. These ports, by default, are assigned in numerical order, hence the reason the numbers keep increasing. This device is now stored in the Device Manager, but it is hidden when it is not attached to the computer. That’s why the port isn’t visible unless the steps below are followed to display hidden and inactive devices. As long as a dedicated USB port is kept for this device everything will work fine. If a jump drive is plugged into this port, chances are high that it will lose the USB to COM association for the Bluetooth dongle. This means that the next time the Bluetooth dongle is plugged in it will reinstall, and by reinstalling, the computer will use new, and higher, COM port numbers. It is possible to force a COM port to use an ‘in-use’ number, but the device will usually not work because the software will have conflicting ports to pull data from. The existing and unused port is not changed when a number is force-changed, it just adds an additional port with the same number.

I did this on a Vista computer; for XP the steps are similar. To open the command prompt in administrator mode, type cmd into the search bar under the windows button. Right-click on the command prompt search result and select run as admin. Select continue when the UAC screen pops up.

If the run administrator option is not available when you right-click, as mine mysteriously has disappeared, then there’s a more aggressive method you’ll have to use to get the command prompt to open up in administrator mode:

Activate the desktop by pressing windows + D.

Press shift+F10.

Click New>Shortcut

Type cmd in the select location box

Type Command Prompt in the shortcut name window.

Click Finish

Right-click the new Command Prompt shortcut icon.

Click Properties

Under the Shortcut Tab click Advanced

Check the box by Run as Administrator (See screenshot below).

Click Apply and OK.

Open the command prompt in Admin mode.

Continue through the UAC screen.

Type set devmgrshownonpresent_devices=1 after the prompt and press Enter.

Type start devmgmt.msc and press Enter to open the device manager.

In Device Manager, Click View and make sure show hidden devices in checked.

Now expand the COM & LPT Port row.

All unavailable COM ports are displayed.

Uninstall all the unused COM ports by selecting them and pressing Delete, then click OK.

Here’s a screenshot of with my hidden ports displayed. It’s a mess; and notice all the COM 6 ports –those were ones I forced to renumber.

And here’s the same screen after uninstalling all the no-longer-needed ports. [![](]( Try to keep a dedicated USB port for your USB dongle. Keep an eye on those COM port numbers and clean up again if they get too high. Sources: []( [](