Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to figure out who's locking my COM port. Tried to search but could not find a way to figure that out. I am using XP.

Was wondering if 'Process Explorer' utility provides something for the same but could not find something helping.

Is there a command that shows up all the applications tied up to specific COM ports on the system?


share|improve this question

migrated from Oct 14 '09 at 15:30

This question came from our site for professional and enthusiast programmers.

I don't think you can. It only needs one more vote before it gets moved, though. – Powerlord Oct 13 '09 at 21:17

Yes, in Process Explorer, the application using the port will have a "File" handle called \Device\SerialN where N is a zero-based index.

enter image description here


The "N" in "serialN" is not the COM port number, it's the index into the list of active ports. If you only have one port in use, it will always (?) be "serial0", and the second one you open will be "serial1". If you open them in the opposite order, the numbers will be reversed.

Check out the QueryDosDevice API. You should be able to iterate through COM1...COM? and get the "\device\serialN" entry for each open port. I'm not aware of a utility that will do this, you may need to roll your own.

There's a more COM-port-specific example here.

share|improve this answer
Thanks, the figure above means it's COM 0? I attached HyperTerminal to COM2 and see the entry as Serial0, same as in the figure shown above. – Manav Sharma Oct 13 '09 at 21:24
@Manav No, it's not the port number. In my case it was COM4 that was open. I updated my answer to address this distinction. – Tim Sylvester Oct 13 '09 at 21:40

You must log in to answer this question.