How to Delete COM Ports In Use

In case you are facing with trouble with your COM ports in use that stacking, these brief steps below will help you to clear them out (for example, when you found myself needing to connect via a USB to Serial adapter to a server and noticed that 35 COM ports showed in use). Somehow the COM ports were not getting cleared out.

The fact is that when you connect a new device, Windows creates a new virtual COM port with a value from 1 to 255. When you remove this device, the created COM port will not be deleted automatically. And any new COM port is assigned the first unallocated COM port number.

Some legacy applications do not work correctly with COM ports with numbers 10 and higher. What to do in case your COM device received such a number? This time we will show you how to delete reserved COM ports and remap the COM port for a particular device.

Delete COM Port in Use

Information about the COM ports in use is stored in the CommDB registry key under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter. However, changing the value of this attribute manually is rather risky. It is much easier to clear information about used COM ports using Device Manager or devcon utility.

com ports in use

Step 1: Run Command prompt

One thing is to see if hidden devices are taking up the ports: run Command Prompt (cmd.exe) with the elevated privileges.

Step 2

Type set devmgr_show_nonpresent_devices=1 in the Command Prompt and then press Enter (you might have to restart your computer after this step).

Step 3

Type cd \Windows\system32 in the Command Prompt and then press Enter.

Step 4

Type start devmgmt.msc in the Command Prompt and then press Enter.

Step 5

Check if the hidden devices are connected to PC.

Click View > Show hidden devices. This will display devices that are not connected to your computer.

Step 6: Uninstall COM ports in use

Now if you expand the section on COM ports, all the COM ports that have ever been created will be displayed (the non-present ones being in grey). You can uninstall away anything that you don’t want (right click, select Uninstall).

how to clear com ports in use

Also, you can clean up garbage COM ports by using the DevCon utility that is included to the Windows Driver Kit (WDK), Visual Studio and Windows SDK for desktop apps. Open the Command Prompt and go to the directory with the program:

Cd %WindowsSdkDir%\tools\x64\

List the busy ports with the command:

devcon findall =ports

clear com ports in use

Now you can consistently remove all unused ports using their IDs, for example:

devcon remove @”PCI\VEN_8086&DEV_A13D&SUBSYS_30BE17AA&REV_31\3&11583659&0&B3”

Thus, you can delete all unnecessary COM ports (if you try to remove the used device, the Remove failed error appears).

remove com ports in use

COM port reassignment

If you need to reassign the COM port for a specific device:

  1. Open the Device Manager;
  2. In the Ports section, open the Properties of the device to which you want to reassign the COM port;
  3. Click the Port Settings tab, and then click the Advanced button;
  4. In the Com Port Number drop-down list, select the desired number and press OK.

windows 10 com ports in use

You may also like:

How to stop Windows 10 from automatically changing... If you are annoyed at the fact that your printer is shared and changing all the time, then there is a little option for that. Microsoft changed the au...
  • Jay Sheldon

    I have tried this in Win 7 x64 and I do not see the ports that are not connected. I am using a USB to Serial adapter (FTDI – virtual com) and when the usb side of the device is connected to the computer it shows in Device Manager, when the usb side of the device is not connected to the computer is does not show in Device Manager (even when using your directions)

    Please advise!

  • I tested this just a few minutes ago and yes, it looks like it has changed a little bit. Got it working. You need to do this. Open up Command Prompt, type: set DEVMGR_SHOW_NONPRESENT_DEVICES=1 and then hit enter. Then type: start devmgmt.msc. Then go up to view and show hidden devices. It should now show up even when it isn’t plugged in.

  • Charlie Chau

    Hi Jay,

    You need administrative privilege in Windows 7. Try enter cmd.exe and press Ctrl-Shift-Enter

  • John Chase

    This didn’t work for me (yes, admin, yes I spelt it right ,etc.)

    But this did…

  • Patrick O’Keeffe

    Step #2 is not effective until you reboot the machine. At least on Windows XP SP3

    • @Patrick: Thank you for mentioning that, I have updated the post above.

  • victor

    This worked. Stupid Windows Vista decided it didn’t like com ports 1-14 anymore.


  • chris

    It worked! Non present devices show up with the port number assigned right next to it.
    That’s exactly what I needed.
    Thank you Brian for sharing your wisdom!

  • mike

    I have over 1200 serial ports in use on my pc is there a way to uninstall several ports at 1 time?

  • stype

    First it didn’t worked for me. But then I booted in safe mode, and do this procedure.
    It still didn’t worked, but then I started deleting all unnecesarry devices like usb disk drives and stuff.
    After some while in Com&ports sections I managed to see some more devices with com ports assigned to them, and only then I could delete them.

  • Bob

    Thanks, this worked for me. The driver initially can up as COM107. All my lower number COM ports were in use so I found these instruction to clear one of the ports:

  • Alfred Theorin

    Worked like a charm, thanks! I suspected those little bastards were hiding somewhere and now I know how to find them. :o)

    To those not getting it to work, you are probably not managing to set the environment variable properly (step 2). No reboot is required and you can see that you were successful if you instead do it like this:
    * Bring up system properties dialog (Win+Pause alt. System in Control Panel) (In Vista/7 also click “Advanced system settings”)
    * Go to the advanced tab and click the “Environment variable…” button. (Hint: You can also find the device manager in the hardware tab in the same dialog, unless you want to show off your command line ninja skills of course. ;o))
    * Click a “New…” button, preferably the upper one but it doesn’t really matter.
    * Fill in variable name devmgr_show_nonpresent_devices and Variable value 1.

    After this all you have to do is reopen the dialog. (Tried on Win XP and Win7)

  • Shiddhartha Nandy

    Thanks, worked a treat in Windows 7 (no reboot was required) when I replaced my motherboard. The com ports werent working and on checking the ports in use there were twice as many as there should be. Your tip allowed me to get rid of the old ones.

  • Muhammad Nadeem Sarwar

    It doesn’t work on win7 home premium.

  • Bryan

    For windows 7 32bit, etc, be sure you are in the Windows directory. Type: cdWindows once you are int he command prompt, then follow steps 2,4,5,6 above.

  • Joost

    Works, but I can only uninstall some comports, but not all are show, so I can’t free all my comports.

    It does show nicely all my connected and unconnected devices.

  • serestma

    hi, anybody know how to install a com port?

  • TammyJo Sessamen

    Hi Brian, got a quick question…what if you uninstall all the COMs and reboot but the COM ports come back and still show that they are in use when there is nothing being shown for the device(s)?

    • Is this machine a member of a domain? If so, you might try logging on as local administrator account and re-follow the steps above.

  • Dale

    Yes, works a treat (reboot definitely required with XP Pro SP3). Many thanks!

  • Frank Nash

    thank you

  • Tim Detwiler

    I’ve used this procedure in Win 10, but it doesn’t show unused com ports
    . How do you do it there?

  • curt

    Ok I figured it out never mind printers, removing to get comports etc..
    Com Ports will not show until you connect a comport. So even though your comport is high and unusable (for a test) go ahead and activate it only then will you see it listed under ports you’ll see the comport shows up but its likely too high for your application, just an exercise so you can see comports will only show if you have something paired.
    Now the reason you have all these unused comports is because drum roll …you have plugged in a multiple USB hub get it ? The hub causes unused com ports to be assigned so when you pair the one com port you need its sequentially high on the list, a number that won’t work. Remove the external hub then create the com port (pair) the one you want, once paired you’ll find your assigned a lower usable comport. Then, if you want, plug the hub in and it will assign comports above the lower number one you just installed. Computer will remember the comports unless you remove the lower comport, no worries just repeat the process to get the right comport.
    Hope this works for you!