How to Delete COM Ports In Use

If you are having trouble with your COM ports stacking up because they are in use, these brief steps below will help you clear them out. (I found myself the other day 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).

Delete COM Ports


Step 1

One thing is to see if hidden devices are taking up the ports:
Click Start > All Programs > Accessories and then click Command Prompt.

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 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

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

Step 6

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).

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...
READ ALSO  7 Best Android Emulators for Windows 10
Tags:, , , ,
  • 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?