How would I go about viewing a list of COM ports in use without the use of Device Manager?

I don't want to install any software either. Is there a possible way to do this through the command line?

  • Please better define "In Use". installed as a device? Has a device attached to it? Is actively transferring data? – Ƭᴇcʜιᴇ007 Nov 4 '14 at 16:33
  • @Ƭᴇcʜιᴇ007 sorry, in use would be having a device attached to it. I have a ttl uart cable plugged into a USB. – Marmstrong Nov 4 '14 at 16:36
  • I suppose you can do this through a powershell script. Why can't you use device manager? Your unwillingness to use something like Putty is odd. – Ramhound Nov 4 '14 at 16:48
  • 1
    @Ramhound Using a University PC which has the device manager locked down to stop people like me fiddling. I can see that the device is COM3 on my laptop. I want to use Putty but I don't know which COM port to use. – Marmstrong Nov 4 '14 at 16:50
  • 2
    @Marmstrong In the command prompt use mode. Used without parameters, mode displays all the controllable attributes of the CON (console) and the available COM devices (and LPT as well) – JosefZ Nov 5 '14 at 0:51

In the command prompt use


Used without parameters, mode displays all the controllable attributes of the CON (console) and the available COM devices (and LPT as well).

Accepts /? switch for basic help:

mode /?

| improve this answer | |
  • Using mode most of the time I don't see the devices that are not connected, as mentioned in @G-M 's answer. – sylvainulg Mar 6 '19 at 14:14

I know the question has been answered, but this is another method.

In command prompt, use:
in windows Vista and up. Lists your ports and which device they are.

| improve this answer | |
  • 1
    Windows 7 "'chgport' is not recognized as an internal or external command, operable program or batch file." – DavidPostill Nov 25 '16 at 13:58
  • 6
    works for me on Win 7 – woky Feb 24 '17 at 8:07
  • chgport /QUERY works for me in Win7 pro. It lists the \Device\name for the currently select com port, not a full list. More interesting, chgport /? shows: (formatting fails) CHANGE PORT [portx=porty | /D portx | /QUERY] portx=porty Map port x to port y. /D portx Delete mapping for port x. /QUERY Display current mapping ports. And chgport COM4=COM5 allows type COM4: to work! – James Newton Aug 31 '17 at 19:11
  • 1
  • 3
    chgport also works in Windows 10 – spikey_richie Mar 7 '19 at 13:22

In the command prompt use:

C:\>wmic path Win32_SerialPort


In PowerShell:

PS> Get-WMIObject Win32_SerialPort


PS> Get-WMIObject Win32_SerialPort | Select-Object Name,DeviceID,Description

Hope this helps.

| improve this answer | |
  • 2
    The command prompt returned No Instance(s) Available. – Marmstrong Nov 4 '14 at 16:46
  • If there are no Com port devices detect then the command results "No Instance(s) Available". Check your "Device Manager" and ensure your machine detected the Com ports in "Device Manager" – vembutech Nov 4 '14 at 16:53
  • OP said "Using a University PC which has the device manager locked down" – DavidPostill Nov 4 '14 at 16:54
  • @vembutech - Looks like you will need to get IT involved in that case. – Ramhound Nov 4 '14 at 16:56
  • @vembutech I have checked the device on my own laptop and it appears as COM3 in device manager but the command prompt still shows the same result. – Marmstrong Nov 4 '14 at 16:56

Using mode most of the time I don't see the devices that are not connected.

I prefer to use this solution with Python:

python -c "import serial.tools.list_ports as ls;print list(ls.comports())"

So I can see anything plugged in even if the connection is closed.

serial.tools.list_ports is from package pyserial.

| improve this answer | |

You can also run the following from cmd.exe prompt


And here is an open source utility to do the same and more: https://todbot.com/blog/2012/03/02/listcomports-windows-command-line-tool-for-usb-to-serial/

| improve this answer | |
  • Thanks! This actually worked. – Mooncrater Sep 2 at 5:50

wmic https://docs.microsoft.com/en-us/windows/desktop/wmisdk/wmic is a windows command line utility to get system information.

If your serial port is virtual created by some driver through USB connection, use this example to get details about these serial ports.

wmic path CIM_LogicalDevice where "Description like 'USB Serial%'" get /value
| improve this answer | |
  • a bit of further information would be helpfull – Albin Nov 16 '18 at 17:55
  • that produces lots of information. get Name instead of get /value might help. Unfortunately, it won't simply list ports, but strings such as "USB Serial Port (COM17)". There are also multiple entries mentioning simply "USB Serial Converter" on my setup. – sylvainulg Mar 6 '19 at 14:22

The snippet below lists serial ports into the $PORTS variable


This function will get a list of ports automatically

PORTS=/c/Windows/System32/mode.com | grep Status.*COM | awk '{ print $4 }' | sed s/://

To the list (use) the ports, see the code below:

echo -n "Programming (echoing) ports: " for aa in $PORTS; do echo -n $aa done echo ""

| improve this answer | |
  • What I like about this answer is that I can use it within a bash script. – fearless_fool Oct 9 at 21:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.