Friday, January 30, 2009

How to clear or Reset COM port ?

Windows always assign a COM port no (like COM2, COM3 etc) every time you connect a USB device like modem, mobile phone or specially serial to USB convertors to system, and this no goes on increasing as every time you connect device windows reserve that port and next time it assign new number.

I recently face some issue because of this, I want to test my new thing magic m5e RFID Reader with BizTalk RFID which is connected to USB of my laptop using a serial to USB convertor, here my system assign a port no COM19, this was a big problem for me as my RFID Device Provider can only access up to COM5 ( it is in pre-beta)  so i need to change COM port to less than COM5, when I tried to do that it shows me list of all 19 ports and mentioned in brackets as “in use”, so i need to free all these ports which are locked by system. I searched every where in device manager , control panel no interface is available to do this in windows, then i found a nice solution for this which allow you to free all ports but for this you need to edit registry,

here are the steps which you can use to free all post.

  1. Click start –> Run –> type regedit and click OK button.
  2. This will open a Registry editor.
  3. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter

regedit - comp port

Now right panel , you can see a key ComDB  right click to that key and click modify.  ComDB

In value Data section select all and delete  reset to Zero ‘0’.

click OK

Close Registry editor and then restart your computer. all COM ports are now Free, you may  need to reinstall any USB to serial convertor.

Note: It is always good to take back up before deleting any entry from Registry, to take back up for Com Name Arbiter, in left panel right click on COM Name Arbiter and say Export, save with some name and appropriate location.

35 comments:

Anonymous said...

Thanks Mahesh,Very useful information, just one suggestion, can you please make those screenshots in PNG instead of JPEG, will be more clear and also will ease for you in uploading.

iulian said...

Thanks Mahesh

Pat said...

Thank you - I've wondered how to do that for a long time now. Mine was up to com55! Now everything's more sane - you rock.

Anonymous said...

Mahesh, will this wipe out physical COM ports in Windows as well and make, say COM1, unavailable?

Uwe Sieber said...

Based upon the information on this page I have just made a little tool for this:
http://www.uwe-sieber.de/files/com_name_arbiter_setter.zip

Uwe Sieber

Anonymous said...

Will resetting the port arbitor work in WinVista and 7 as well? Will it wipe out Windows physical ports COM1 & 2? Thanks!

Anonymous said...

Can someone test this in Windows 7 32 & 64 bit O.S.? Also, it should be noted to uninstall and then unplug any serial to USB adapters/harware.

Anonymous said...

I used this procedure months ago when my Win 7/64 machine got itself up to about comm10. It works perfectly and is completely safe if you're comfortable poking around the registry.

Anonymous said...

wow!! exactly what i'm searching..u are brilliant! thank you!

Anonymous said...

Just what I needed. I ow you a cup of coffee

Anonymous said...

Looked at my registry, and value was 1c. The last device I added was COM5. I deleted it, and the regis. val. was 0c. Knowing that the binary for 1c was 00011100, I concluded that the bits, right to left were for COM1-COM8. Wrote the Registry from 0c to 08 (thinking I'd free COM3). When I reinserted the device I had deleted, it was assigned COM3. Looks like you can selectively clear COM port numbers, if you choose. Also, looks like COM1 and 2 are already zero - and not available to the user.

Andy said...

This helped me out no end when trying to use a bluetooth OBD2 ELM327 interface, where all of the freeware available has a limit of comm ports 1-8. Thank you very much.

Anonymous said...

Absolutely great Op , and thanks for making it easier Uwe , mine was up to 26 and i was getting lost...

commuter676 said...

Pure Genius! Thanks.

Anonymous said...

Awesome, thanks! For those worrying, I set all to 0 on my Win7-64 (pro) and COM1 and LPT1 were both preserved. We're good now.

Anonymous said...

Awesome, this worked a treat in Windows 7 32-bit on a bunch of Com Ports that showed open/still in use even after removing ghosted devices.

(I found Ghostbuster for that)

Thanks so much!

Anonymous said...

When you say reset to zero are you saying to simply type 0 in the data section and close? Not 00. as they appear.

Thanks.

Richard

Anonymous said...

I was looking for it.... Suddenlt ur post came to me like a charm... thats useful post...

Anonymous said...

win 7 64bit, does not work...

Anonymous said...

I work with Samsung smartphones, and each and every one installs new virtual COM ports for modem and diagnostics interface... I've gotten to COM1024 before I started having problems with using the newly registered ones. USBdeview let me uninstall the devices en masse, but it couldn't do anything about the COM port number issue. This little trick saved me a possible Windows reinstall, so thank you very much :)

Tibor

Mirfster said...

Hello all, I have been doing a fair amount of testing with USB AirCards and noticed the same thing. However, even after doing the steps that pointed out, I discovered that if you look under “Printer Server Properties” in the “Ports” section you will still see all the COM Ports.

Trying to delete these (with Admin Rights) results in the error: “Selected port cannot be deleted. The request is not supported”

I am running Win7 x64, anyone else see the same thing?

Afan Rohman said...

wow it's work
thankz

Kurt said...

Thank you very much!

I wasn't able to program Arduino's anymore using a laptop that I used many times before for that purpose with success.

Have been fighting all day with it, checking cables, installing new drivers, new software, disabling/enabling services, bluetooth, restarting again and again...

However the USBtoCOM driver always picked an unused port, it was remarkable how many ports were supposedly in use.

Used your tip, and finally... all works fine again!

Thank you, I appreciate it very much when people unselfishly post their knowledge on-line...

Jesyca Fuenmayor said...

Hi I've done what you said in the post to delete all my COM ports but now, I'm trying to connect an Arduino for the first time to the computer and for some reason it's not being recognized. I really don't know why but it seems that to my computer there are no ports connected even if I have the Arduino plugged-in. Do you know what can be happening? Thank you

Anonymous said...

Didn't work on windows 7 for me : (

Anonymous said...

Thanks very much. Have been looking for this resolution for ages. Worked a treat on my Windows 7 OS

Anonymous said...

GReat . Thanks. win 7 64 bits

Anonymous said...

thanks so much, I was searching since too much time

Anonymous said...

Thanks, worked on my Vista machine, the hard part was finding the run prompt. Just click start-search, type "run"

Anonymous said...

Have been searching the Internet for weeks as I ended up with 25 com port numbers! I have 5 usb devices and Didn't know every time I plug the same device into a different USB port, a new com port number was generated. Duh... Tried all the usual windows support websites and no solution - until I chanced upon yours! Worked for my Vista computer easy peasy! Thanks so much for sharing. This should be a sticky on every windows computer.

saleem said...

Brilliant!!!

My pc was on port 143 already...

Great stuff!!!

Thank you ever so kindly!!!

gawally said...

There is another way which appears a few times on searches. It does work on 64 bit

Open command prompt as administrator
Go to home directory cd\
Type in
set devmgr_show_nonpresent_devices=1
Type in
start devmgmt.msc
Control panel device manager window will open. Click on View/Show hidden devices. Click to show the Com ports and they will all be shown. Right click and uninstall each one. The not in use ones will be a lighter colour.

gawally said...

A bit more to my previous comment
To open command prompt
Click on start then all programs then accessories. Right click on Command prompt and then click on Run as Administrator.
This method does not need you to play with the registry and does not require a restart

caphil said...

Thanks gawally for the alternate approach.

I am running Win 8-64 and tried your technique, but don't see the COM ports listed and can't find them anywhere. What exactly do you mean when you say Click to show the Com ports? Maybe this is different on Win 8.

Anonymous said...

Hi, Mine is a Windows 2003 64 bit. Com1 and Com2 are showing in Devmgmt.msc but even if have my SMS gateway connected, I am not able to type even a single command in the hyperterminal console.

I am trying to type AT and expecting one OK response...

Please help me.

Regards,
Jyotiprakash