Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

Thanks

share|improve this question

migrated from stackoverflow.com 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
add comment

1 Answer

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

Update:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.