Every time you plug in a COM or USB device to your computer, Windows creates a virtual COM port and assigns it for a device. Every COM port has its number from 1 to 255. Also, each port is assigned exclusively for one device and remains occupied (Windows shows it as “in use”) even if the device itself is not plugged in anymore. Most of the time this is not a big deal or problem unless a user tries to run some ancient software that has trouble working with COM-ports higher than 9. For example, a piece of software may work well with COM1 to 9 but fail if there are no free COM ports below COM10. Another issue may appear when some specific devices take too many ports. For example, some adapters may reserve up to 30 or even more COM ports. In such scenario you are forced to delete COM ports in use in Windows or reassign a used COM port to a different device. In this article, we will show you how to do this.
Clear COM Ports in Use
There are different methods of how to delete COM ports in use. Luckily, there are different apps with a decent UI you can use to work with COM ports on your computer. Windows stores COM ports assignments in the registry key called COM Name Arbiter. We will show how to use the Registry Editor to clear or reassign COM ports, but first let us focus on more user-friendly ways to delete COM ports in use.
Caution: Before deleting COM ports in use, make sure to create a system restore point. Having a backup gives you a path back in case something goes wrong. The system restore point will help you to go back quickly and restore your system functionality.
Reassign COM Ports Using the Device Manager
First, let us go through the simplest method. You can quickly reassign COM port using the built-in Device Manager. This will work only if you have a free COM port you need to reassign. For example, Windows assigned COM24, but you need COM9 or any other COM port.
- On your keyboard, press Win + R and enter the devmgmt.msc command. This is a universal command that works in any recent Windows version;
- Locate the Ports section and expand it;
- Find the device you need to reassign COM port and right-click it. Select Properties;
- In a new window, go to the Port Settings tab and press the Advanced button;
- Select a new COM port number from the COM Port Number drop-down list at the bottom of a new window.
This will work only if the COM port you need to use is free. If Windows says the port you need is in use, these instructions won’t work. Do not worry, though. You can manually delete the used COM port and reassign it for a new device.
Delete COM Ports in Use on Windows
- Open your system’s properties and press the Advanced system settings link;
- In a new window, press the Environment Variables button;
- In the User variables section, click the New button;
- Set Variable name to devmgr_show_nonpresent_devices and the Variable value to 1;
- Now, launch the Device Manager using Win + R and devmgmt.msc command;
- Now you need to force the Device Manager to show disconnected and unavailable devices. You need this to delete COM ports in use. Press View – Show Hidden Devices;
- The next step is to display all COM ports in use. Locate the Ports (COM & LPT) section. Do notice that every device shows which port it occupies. Tip: disconnected devices have translucent icons and devices you have plugged in to show a regular icon. Do not uninstall the devices currently connected;
- Find the port you need to free and right-click it. Select Uninstall. If some specific device occupies several ports simultaneously, you need to remove them altogether;
- After this, Windows will free a port, so you can assign it to the device you need. Go back to the Reassign COM ports using the Device Manager section and follow it to reassign the port you just made free.
There is another way how to check which COM ports are currently in use. Although there is nothing wrong with using the Device Manager, you can check the list using it. Launch the PowerShell in Admin mode and paste the following command:
Get-WMIObject Win32_SerialPort | Select-Object Name,DeviceID,Description
Clear COM Ports Using COM Name Arbiter Tool
Also, you can easily delete COM ports with the help of a third-party tool called COM Name Arbiter Setter. It is completely free, and you can download it on the official website. This utility helps you to modify registry parameter ComDB simply without taking the risk to accidentally remove or edit wrong strings in the Registry Editor.
Download the COM Name Arbiter Tool from the official website and run the executable file with Administrator privileges.
This tool’s main window shows the list of all COM ports and places a checkmark next to the currently occupied ports with present devices. If a device is not connected, hit Remove non-present devices. This will clear all assigned COM ports and make them available to assign. You can also clear the COM port manually, by unchecking a specific device from the list. This app automatically applies all the changes, so there’s no need to manually hit the Apply button.
Tip. You can also use a third-party tool called Device Cleanup Tool to remove non-present devices and clean up occupied COM ports. The Device Cleanup Tool is available for free from the official website.
Using DevCon to Delete Unused COM Ports
Also, you can clean up assigned COM ports with the help of DevCon utility that comes built-in with the Windows Driver Kit (WDK), Visual Studio, and Windows SDK for desktop apps.
- Run the Command Prompt as Administrator and paste the following command:
- List the reserved COM ports using the command:
devcon findall =ports
- Now you can 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) and reassign them to different devices.
Reset COM ports using the Registry Editor
Now, let us talk about the most challenging methods of how to delete COM ports in use. In this part, we won’t use any third-party tools. All is needed is the Registry Editor which is a part of every Windows installation.
Caution: Backup the important data and create a system restore point. Follow the instruction strictly and be careful not to edit random fields. Breaking the COM ports assignment registry key may end up getting lots of BSODs. We are pretty sure you don’t want this.
- Disconnect all peripheral devices;
- Press Win + R on your keyboard. Enter the regedit command to run the Registry Editor;
- Go to the following path: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter. If you use Windows 10, just copy the path, and enter it into the address field;
- On the left side of a window, right-click COM Name Arbiter and select Export. Save the export somewhere you can easily access it in case something goes wrong. In case of emergency, this will help you restore the previous working settings;
- If you want to reset all COM ports, change the ComDB value to . ComDB’s binary value defines the list of reserved COM ports. Every bit defines the status of the corresponding port (1 to 255);
- You can also find the list of all assigned COM ports in the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports path. You can delete all the ports you want to free;
- Restart your computer. When it boots back, connect all the devices in the proper order.
That’s it! Now you know how to delete COM ports and reassign them to a different device.