Windows – Now who’s using the COM port

administrationservicestroubleshootingwindows

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

Best 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.