11

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

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

1 Answer 1

8

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.

4
  • 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
    Commented Oct 13, 2009 at 21:24
  • 1
    @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. Commented Oct 13, 2009 at 21:40
  • 2
    In case someone tries this: With my USB->Serial adapter in Windows 10, the device name is not \Device\Serial0 but \Device\VCP0, probably for Virtual Com Port (my guess).
    – Jens
    Commented Sep 3, 2019 at 10:52
  • You can find the COM port in the map saved to the registry key HKLM\HARDWARE\DEVICEMAP\SERIALCOMM. In fact, you can see in the screenshot the hypterm process open that key to lookup which device to open. Commented Jun 25 at 18:11

You must log in to answer this question.